Filtered alias on two values


(makovskij) #1

Hi there,

i'd like to make two an filtered alias on two values. Like this example:

curl -XPOST 'http://localhost:9200/_aliases’ -d '
{
    “actions” : [
        {
            “add” : {
                 “index” : “test1”,
                 “alias” : “alias2”,
                 “filter” : { “term” : { “user” : “kimchy” } },
                 “filter” : { “term” : { “user” : “kimchy_new” } }
            }
        }
    ]
}’

That means if i search with "alias2" i get all fields with user=kimchy and kimchy_new. With the above example ES overwrites the termfilter kimchy and i onliy see kimchy_new. But i'd like to have both.
Since an alias on aliases isn't possible , i thought this would be possible . Is there a way to do that?

Regards
Andi


(Bob) #2

I need the same solution here but it does not show up on the forum. Is there an answer to this question?


(Bob) #3

I believe this is the right way to do this:
curl -XPOST 'http://localhost:9200/_aliases' -d '
{
"actions" : [
{
"add" : {
"index" : "test1",
"alias" : "alias2",
"filter" : { "terms" : { "user" : ["kimchy", "kimchy_new" ] } }
}
}
]
}'


(system) #4