# Alias with filter not explicit at indexing--\>not in alias?

**URL:** <https://discuss.elastic.co/t/alias-with-filter-not-explicit-at-indexing-not-in-alias/39647>\
**Category:** Elasticsearch\
**Created:** [January 20, 2016, 11:48am UTC](https://discuss.elastic.co/t/alias-with-filter-not-explicit-at-indexing-not-in-alias/39647 "2016-01-20T11:48:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandros/32/6348_2.png) [@sandros](https://discuss.elastic.co/u/sandros)\
**Post date:** [January 20, 2016, 11:48am UTC](https://discuss.elastic.co/t/alias-with-filter-not-explicit-at-indexing-not-in-alias/39647/1 "2016-01-20T11:48:59Z")

</div>

So I have an index with the following alias defined:  
`bod = { "routing": "goHere", "filter": { "bool": { "must": [{ "term": {"algo": "algo1"} }, { "term": {"client": "MyClient"} }] } }}`

And then send it to ES from python via:  
`es.indices.put_alias(index=INDEX_NAME, name="CoolAliasName", body=bod)`

This all works fine and as expected if I send a new document to index to the alias, i.e (curl-exple since I guess more people familiar with this rather than python).:  
`curl -XPOST 'localhost:9200/CoolAliasName/algos/_index' -d '{"client":"MyClient",[...],"algo":"algo1"}'`

Then I find this documen with

`curl -XGET 'localhost:9200/CoolAliasName/_search`

But If I change the index operation to (index change from CollAliasName to master\_index):  
`curl -XPOST 'localhost:9200/master_index/algos/_index' -d '{"client":"MyClient",[...],"algo":"algo1"}'`

then the document is indexed, but I cant find it in the alias "CoolAliasName" even if the conditions for being there are satisfied. Is it because algo==algo1 and client==MyClient satisfy the alias def, but I do not specify the routing?

---

<div class="post-metadata">

**Author:** ![sandros](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandros/32/6348_2.png) [@sandros](https://discuss.elastic.co/u/sandros)\
**Post date:** [January 20, 2016, 3:29pm UTC](https://discuss.elastic.co/t/alias-with-filter-not-explicit-at-indexing-not-in-alias/39647/2 "2016-01-20T15:29:11Z")

</div>

Ok did some more tries, added routing value and removed the \_index since ES saw it as an ID, forgot that with curl and POST it is not needed (and would be op\_type-param anyway).  
Setting the routing when indexing does the job.

---

<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, 11:23pm UTC](https://discuss.elastic.co/t/alias-with-filter-not-explicit-at-indexing-not-in-alias/39647/3 "2017-07-05T23:23:00Z")

</div>


