Elasticsearch exact filter term limits?

Hello,
I want to know what are the limits of exact filter terms.

If I have 2 millions of documents with simple data like indexed in one index with 5 shards and 1 replicas :
{
"attr1" : "hello",
"attr2" : false,
"attr3" : 1568913082520,
"attr4" : true
}
when I launch this request which represents a an exact term filter :
AND( OR(attr1=hello,attr2=false), x<attr3<y, OR(attr1=hello, attr4=true))

 "query": {
        "bool": {
            "filter": {
                "bool": {
                    "must": [
                        {
                            "bool": {
                                "should": [
                                    {
                                        "term": {
                                            "attr1": "hello"
                                        }
                                    },
                                    {
                                        "term": {
                                            "attr2": false
                                        }
                                    }
                                ]
                            }
                        },
                        {
                           "range": {
                              "attr3": {
                                  "gte": 1568239200000,
                                  "lte": 1568913151313
                              }
                          }
                        },
                        {
                            "bool": {
                                "should": [
                                    {
                                        "term": {
                                            "attr1": "hello"
                                        }
                                    },
                                    {
                                        "term": {
                                            "attr4": true
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        }
    }

I want to know by filtering on data in this way, do I will get accurate count of documents when I set "track_total_hits" to true. And I want to know if it will match really all the documents
Thank you !

Hello,
Does anyone have an idea about this ? the "total" number is accurate ? Are all the documents respecting the filter rules are matched ?

Thank you,

Prior to version 7, Elasticsearch would always return you an accurate number of hits. Since version 7.0, as a performance optimization, Elasticsearch will return an accurate number up to 10000 by default. If you want to always get an accurate number, you need to provide the track_total_hits parameter, set to true.

1 Like

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