Is ES smart enough to only check documents that are used?

Hi,

Not sure if the title is good enough.
I was wondering if ES is smart enough to filter documents by the fields that are used in aggregations or not.

For example, given this query:

{
  "aggs": {
    "bytes": {
      "sum": {
        "field": "bytes"
      }
    }
  }
}

Now lets say I have 1 million documents, some of them have the bytes field, and some don't.

Will the query be faster if I add a range filter with bytes:>0, or will ES know not to query documents that don't have the bytes field in the first place?

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