0
votes

I have a query like:

  "query": {
    "bool": {
      "filter": [{
        "bool": {
          "must": [{
            "exists": {
              "field": "userName"
            }
          }]
        }
      }]
    }
  }

I wonder if the internal bool query will get scored and then the score will be dropped on the floor by the outer bool query? Or, the elastic will figure out that it doesn't need to calculate the score for the internal query and will skip doing that.

I ask because I have some queries like this and I could replace the internal must clause with a filter clause if that would really speed it up.

I'm on Elastic 6.x

Thanks!

1

1 Answers

0
votes

Alright, I found out about query profiling. I did some tests and the answer is that the top level filter stops the inner query from wasting time on score.