# Exists query is quiet slower than terms query

**URL:** <https://discuss.elastic.co/t/exists-query-is-quiet-slower-than-terms-query/196132>\
**Category:** Elasticsearch\
**Created:** [August 21, 2019, 2:18pm UTC](https://discuss.elastic.co/t/exists-query-is-quiet-slower-than-terms-query/196132 "2019-08-21T14:18:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![willam\_boss](https://avatars.discourse-cdn.com/v4/letter/w/3ab097/32.png) [@willam\_boss](https://discuss.elastic.co/u/willam_boss)\
**Post date:** [August 21, 2019, 2:18pm UTC](https://discuss.elastic.co/t/exists-query-is-quiet-slower-than-terms-query/196132/1 "2019-08-21T14:18:08Z")

</div>

document like

```
 {
"address": {
    "street": "ss",
    "city": "ffff",
    "country": "jjjj"
},
"links": [
    {
        "name": "Google",
        "url": "http://www.google.com"
    },
    {
        "name": "Baidu",
        "url": "http://www.baidu.com"
    },
    {
        "name": "SoSo",
        "url": "http://www.SoSo.com"
    }
]
}

```

I have almost 1 billiion docs use about 3T disk,druring 10 servers with 8 cores 32G memory, ssd  
query like

```
{
"size": 10,
"query": {
    "bool": {
        "filter": [
            {
                "exists": {
                    "field": "address"
                }
            },
            {
                "exists": {
                    "field": "links"
                }
            }
        ]
    }
}
}

```

will take about 300 seconds but term query will return quickly , why this happen? is there any difference between term query and exists query ? How can I speed up exists query?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 22, 2019, 12:31pm UTC](https://discuss.elastic.co/t/exists-query-is-quiet-slower-than-terms-query/196132/2 "2019-08-22T12:31:47Z")

</div>

you can use the [profile API](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-profile.html) to figure out which part of your search took so much time. Maybe share those results, and then we can go from there.

---

<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:** [September 19, 2019, 12:31pm UTC](https://discuss.elastic.co/t/exists-query-is-quiet-slower-than-terms-query/196132/3 "2019-09-19T12:31:57Z")

</div>

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