Elastic search coordinating-node role - complex aggregations

I understood coordinate node broadcasts the search request and gathers the results received from data nodes using "query then fetch phase" .

Does it do it in one iteration of "query then fetch phase" or a search request can have multiple iterations of query then fetch phases?

Say taking a complex filter query taken from Elastic Search Complex Scenario (credits : Val, Thanks @Val), will it involve multiple iterations of query then fetch phases? what are the steps the coordinating node does to answer this query

{
  "query": {
    "filtered": {
      "query": {
        "match": {
          "product_name": "xxx"
        }
      },
      "filter": {
        "bool": {
          "must": [
            {
              "range": {
                "price": {
                  "gte": 20,
                  "lte": 170
                }
              }
            },
            {
              "term": {
                "availability": "availability_status"
              }
            },
            {
              "term": {
                "user": 1
              }
            }
          ]
        }
      }
    }
  }
}

Hi nages,
The complexity of a query doesn't increase the number of phases.

There can be some pre-flight visits to test if a query can match at all on a shard (e.g. it might not have any of the required fields) or stats-gathering for special scoring modes (DFS).

None of these decisions are influenced by the complexity of your query though - this requires a one-time pass over the data.

It seems like elastic search address most(if not all) of the queries using one iteration of Query then fetch . Am I right ? Would you sharing document , i went through the online documentation , but didnt get a correct picture.

Yes. The phases are discussed here.

thanks Mark, I went through the document earlier but seems like many details were abstract like pre flight visits , plan etc :slight_smile: . Perhaps, i may need to look at the source code..

Thanks anyways

The details change as various things are optimised and evolve.
There are a number of "it depends" e.g. the "canMatch" pre-flight phase will not run if there's insufficient numbers of shards being queried or custom search routing is used or DFS is used.
Cross-cluster-search is another consideration.

Here's probably a good place to start if you're curious.

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