# Searching through an alias with filter is very slow in Elasticsearch

**URL:** <https://discuss.elastic.co/t/searching-through-an-alias-with-filter-is-very-slow-in-elasticsearch/74503>\
**Category:** Elasticsearch\
**Created:** [February 9, 2017, 1:09pm UTC](https://discuss.elastic.co/t/searching-through-an-alias-with-filter-is-very-slow-in-elasticsearch/74503 "2017-02-09T13:09:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yannisf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yannisf/32/15370_2.png) [@yannisf](https://discuss.elastic.co/u/yannisf)\
**Post date:** [February 9, 2017, 1:09pm UTC](https://discuss.elastic.co/t/searching-through-an-alias-with-filter-is-very-slow-in-elasticsearch/74503/1 "2017-02-09T13:09:45Z")

</div>

I have an elasticsearch index, _my\_index_, with millions of documents, with key _my\_uuid_. On top of that index I have several **filtered aliases** of the following form (showing only _my\_alias_ as retrieved by `GET my_index/_alias/my_alias`):

```
{
    "my_index": {
        "aliases": {
            "my_alias": {
                "filter": {
                    "terms": {
                        "my_uuid": [
                            "0944581b-9bf2-49e1-9bd0-4313d2398cf6",
                            "b6327e90-86f6-42eb-8fde-772397b8e926",
                            thousands of rows...
                        ]
                    }
                }
            }
        }
    }
}

```

My understanding is that the filter will be cached transparently for me, without having to do any configuration. The thing is I am experiencing very slow searches, when going through the alias, which suggests that 1. _the filter is not cached_, or 2. _it is wrongly written_.

Indicative numbers:

```
GET my_index/_search -> 50ms 
GET my_alias/_search -> 8000ms

```

I can provide further information on the cluster scale, and size of data if anyone considers this relevant.

I am using elasticsearch 2.4.1. I am getting the right results, it is just the performance that concerns me.

(This question originally appeared in stackoverflow but did not draw any attention)

---

<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:** [March 9, 2017, 1:10pm UTC](https://discuss.elastic.co/t/searching-through-an-alias-with-filter-is-very-slow-in-elasticsearch/74503/2 "2017-03-09T13:10:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
