Percolation queries on range filter return different response in ES 7.2 and ES 8.7

I am migrating an index from ES 7.2 to ES 8.7 . The index is used for percolation. Most queries work fine and return identical response from both clusters (queries are being made to both clusters paralelly and results are compared). However, range filters (or perc documents) in ES 8 cluster aren't working properly.
Percolation queries that return corresponding documents with range based filters from ES 7 cluster, ES8 cluster doesn't return same documents for same query.The documents in both indices are exactly the same, no missing documents.
The mapping is the same.
All the other filters i.e term/match based queries, work perfectly fine. The issue is only for range filters.What could be the potential issue here or something that I might be doing wrong?

A sample query along with a document it fails to return

 sample query along with a document it fails to return

A sample query:
 curl --location 'http://localhost:9200/my-index/_search?pretty=true' \
 --header 'Content-Type: application/json' \
 --data '{
     "query": {
         "bool": {
             "filter": [
                 {"term": {"field": "abc"}},
                 {"term": {"perc_type": "xyz"}},
                 {
                     "percolate": {
                         "field": "query",
                         "document": {
                             "created_at": "2024-08-14T05:51:38.569Z"
                         }
                     }
                 }
             ]
             }
         },
     "_source": false
 }'
A document it fails to return:
{
  "_index": "my-index",
  "_id": "<id>",
  "_version": 1,
  "_seq_no": 1297,
  "_primary_term": 3,
  "found": true,
  "_source": {
    "field": "abc",
    "perc_type": "xyz",
    "query": {
      "constant_score": {
        "filter": {
          "bool": {
            "must": [
              {
                "bool": {
                  "filter": {
                    "range": {
                      "created_at": {
                        "gte": "now-1d",
                        "lte": "now"
                      }
                    }
                  }
                }
              }
            ]
          }
        }
      }
    }
  }
}

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

Have a look at the Elastic Stack and Solutions Help · Forums and Slack | Elastic page. It contains also lot of useful information on how to ask for help.

1 Like