# Why do the greater than comparison and the greater than equal comparsion not return the same count of documents

**URL:** <https://discuss.elastic.co/t/why-do-the-greater-than-comparison-and-the-greater-than-equal-comparsion-not-return-the-same-count-of-documents/250497>\
**Category:** Elasticsearch\
**Created:** [September 30, 2020, 11:35am UTC](https://discuss.elastic.co/t/why-do-the-greater-than-comparison-and-the-greater-than-equal-comparsion-not-return-the-same-count-of-documents/250497 "2020-09-30T11:35:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian1](https://avatars.discourse-cdn.com/v4/letter/f/c2a13f/32.png) [@Florian1](https://discuss.elastic.co/u/Florian1)\
**Post date:** [September 30, 2020, 11:35am UTC](https://discuss.elastic.co/t/why-do-the-greater-than-comparison-and-the-greater-than-equal-comparsion-not-return-the-same-count-of-documents/250497/1 "2020-09-30T11:35:40Z")

</div>

I have create a new Index and then added two documents to it.

`PUT test_index`  
`PUT /test_index/_doc/1 { "A" : "5" }`  
`PUT /test_index/_doc/2 { "B" : "5" }`

After that I searched for every document with A greater than emty in that index,

`GET test_index/_search { "query": { "range": { "A": { "gt": "" } } }, "size": 2000 }`

, and recieved no document.

`{ "took" : 0, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 0, "relation" : "eq" }, "max_score" : null, "hits" : [] } }`

On the other hand when I searched for every document with A greater than equal empty,

`GET test_index/_search { "query": { "range": { "A": { "gte": "" } } }, "size": 2000 }`

, I recived one document .

`{ "took" : 0, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 1, "relation" : "eq" }, "max_score" : 1.0, "hits" : [{ "_index" : "test_index", "_type" : "_doc", "_id" : "1", "_score" : 1.0, "_source" : { "A" : "5" } }] } }`

Why does the greater than comparison behave different and does not return a document, too?

---

<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:** [October 28, 2020, 11:35am UTC](https://discuss.elastic.co/t/why-do-the-greater-than-comparison-and-the-greater-than-equal-comparsion-not-return-the-same-count-of-documents/250497/2 "2020-10-28T11:35:42Z")

</div>

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