Execution plan for es search?

If i have a query:

"query": {
    "bool": {
        "filter": [
            {
                "term": {
                    "field1": "f1"
                }
            },
            {
                "range": {
                    "field3": {
                        "gt": "1"
                    }
                }
            }
        ]
    }
}

The query has two query item,es will create two thread(each thread just execute one query item),and merge result in the end?

Or,es will execute two query item one by one,for example term "field1":"f1" just get 100 documents,and then range field3 gt 1 just filter in the 100 documents instead of all documents?

Hi @famoss,

each query is processed by a single thread (per shard). See the Definitive Guide on an in-depth explanation of what's going on under the cover.

Daniel

Also please do not PM people to get answers to your threads.

If you need answers quickly then there are commercial subscriptions to assist you.

Thank you.Because there is just one thread to execute one query,so i should be care of the filter order?

For example, just as the question,if condition 1 just get 100 documents,and condition 2 can get 1000000 documents,i should place condition 1 before condition 2?

I'm very sorry

In recent versions of elasticsearch we take care of this internally and we run fastest filters first.
In old versions, yes, order was super important.

In old versions, yes, order was super important

From which version? from v2+?

IIRC yes.

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