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?