Range queries

I have a source object similar to this

"_source" : {
      "phone" : "1234567890",
      "email" : "test_test.com",
      "group" : "test",
      "name" : "Rhonda Shawarma",
      "prop.size_min" : "0",
      "prop.size_max" : "1000000"
    }

I wrote a basic query on Kibana which works fine

{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "prop.size_max": {
              "gte": "100"
            }
          }
        },
        {
          "range": {
            "prop.size_min": {
              "lte": "100"
            }
          }
        }
      ]
    }
  }
}

This returns the document for me but when I change lte and gte to "101" or even store them as integers and try it with 101 (Not as a string) then I don't get the document back. Is there something I'm missing or doing wrong here?

Hi @afzal.

Please check here-

range

Thanks
HadoopHelp

What is the mapping?

My mapping was incorrect. Thanks for pointing it out. My initial data had string so ES created a string mapping so it didn't matter if I tried with long.
After initializing the index with long for certain fields it was working fine. Thanks!

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