I need to search my ElasticSearch indexes using alias.
I see there is a few comments on the forum about searching spesific index by including the index name to search in the query like below example. This will not work using alias and this will not target the index directly, so it's not a good way to do the search.
"query": {
"bool": {
"must": [
{
"term": {
"_index": {
"value": "myindexname"
}
}
},
The preffered way would be to add the index or alias name in the URL like the example below. This will only search the selected alias. But I can't find any way to add this my-alias value.
If this is not possible it should be very easy for retool to add this functionality. The only thing needed is a textfield in the datasource page for indexname and if this is filled out it's added in the URL.
Does anyone has a working solution for this??
curl -X POST "http://localhost:9200/my-alias/_search" -H "Content-Type: application/json" -d '{
"query": {
"match": {
"status": "error"
}
}
}'