# How to determine a difference in results from the same query?

**URL:** https://discuss.elastic.co/t/how-to-determine-a-difference-in-results-from-the-same-query/206063
**Category:** Elasticsearch
**Created:** [October 31, 2019, 2:44pm UTC](https://discuss.elastic.co/t/how-to-determine-a-difference-in-results-from-the-same-query/206063 "2019-10-31T14:44:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Bart\_de\_Man](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bart_de_man/32/48319_2.png) [@Bart\_de\_Man](https://discuss.elastic.co/u/Bart_de_Man)
#### Post date: [October 31, 2019, 2:44pm UTC](https://discuss.elastic.co/t/how-to-determine-a-difference-in-results-from-the-same-query/206063/1 "2019-10-31T14:44:41Z")

</div>

My settings:  
**Elasticsearch version** ( `bin/elasticsearch --version` ):  
5.6.11  
**Plugins installed** :

**JVM version** ( `java -version` ):  
openjdk version "1.8.0\_222"  
OpenJDK Runtime Environment (build 1.8.0\_222-8u222-b10-1ubuntu1~16.04.1-b10)  
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

**OS version** ( `uname -a` if on a Unix-like system):  
Linux myserver 4.4.0-131-generic #157-Ubuntu SMP Thu Jul 12 15:51:36 UTC 2018 x86\_64 x86\_64 x86\_64 GNU/Linux

Hi all,

I'm wondering how I could determine a difference of the results within the resulted documents with the same query?

For Example:  
On Monday I perform the query:

```auto
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": "transactions",
            "query": {
              "range": {
                "transactions.date": {
                  "gte": "2000-01-01",
                  "lte": "2019-12-31"
                }
              }
            }
          }
        }
      ]
    }
  },
  "size": 500,
  "_source": [
    "transactions"
  ]
}

```

In this example I get 205 results.

On Friday I perform the same query as above  
I get 205 results again, BUT within one of the transactions in one of the documents, something has changed.

How would I be able to determine such a change?

I tried to google for quite a while without any concrete results or people with similar problems.

I came up with a solution in theory and would like have some opinions, its as follows:

- I would; Compute a hash of the transactions within the document, perhaps the whole array computed as a hash and put this hash into the document as a seperate field.
- Use this hash for comparison when I perform the same search later and compare the hashes from the result to the ones stored in my DB.

Thanks in advance!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 28, 2019, 2:44pm UTC](https://discuss.elastic.co/t/how-to-determine-a-difference-in-results-from-the-same-query/206063/2 "2019-11-28T14:44:46Z")

</div>

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