# Filtered alias on two values

**URL:** <https://discuss.elastic.co/t/filtered-alias-on-two-values/24257>\
**Category:** Elasticsearch\
**Created:** [June 24, 2015, 12:18pm UTC](https://discuss.elastic.co/t/filtered-alias-on-two-values/24257 "2015-06-24T12:18:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andimak](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@andimak](https://discuss.elastic.co/u/andimak)\
**Post date:** [June 24, 2015, 12:18pm UTC](https://discuss.elastic.co/t/filtered-alias-on-two-values/24257/1 "2015-06-24T12:18:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bblank](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@bblank](https://discuss.elastic.co/u/bblank)\
**Post date:** [October 20, 2016, 7:10pm UTC](https://discuss.elastic.co/t/filtered-alias-on-two-values/24257/2 "2016-10-20T19:10:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bblank](https://avatars.discourse-cdn.com/v4/letter/b/f14d63/32.png) [@bblank](https://discuss.elastic.co/u/bblank)\
**Post date:** [October 20, 2016, 9:06pm UTC](https://discuss.elastic.co/t/filtered-alias-on-two-values/24257/3 "2016-10-20T21:06:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:10pm UTC](https://discuss.elastic.co/t/filtered-alias-on-two-values/24257/4 "2017-07-05T22:10:43Z")

</div>


