Hello all,
I am trying to create an index alias with a filter clause. The field that i would like to filter on is a nested field named "fields.app_id". I would like to create an alias based on the value set in fields.app_id. While doing some reading, i found that the mapping needs to be of the nested type which I've set in the mapping.
"type" : "nested",
"properties" : {
"app_id" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
Now when I try to create the index alias with the filter clause at the end, elastic acknowledges as true however when I try to query the alias itself, the hit count is always 0. Seems the filter isn't actually working. Below is my actual command I'm running to try to create the alias
{
"actions" : [
{
"add" : {
"index" : "ecom-generic-2019.11.18",
"alias" : "ecom-cre",
"filter" : { "term" : { "fields.app_id" : "cre" } }
}
}
]
}
Ideally the above would grab all documents in the ecom-generic-<date>
index with the fields.app_id: cre
and create an alias out of it and Elastic has created the alias however I don't see an documents in there.
Is the filter clause wrong? I tried to use the query context but Elastic didn't like that either. Any help would be appreciated.
Thanks!