Elasticsearch range query


#1

Hi All,

I have a problem while searching records using range query in the below format,
{
"query": {
"range" : {
"identification.numberOfEmployees.value" : {
"gt" : "5",
"lt" : "10"
}
}
}
}
When I am trying to execute above query, i am getting empty result, but when I am trying with below query,
{
"query": {
"range" : {
"identification.numberOfEmployees.value" : {
"gt" : "5"
}
}
}
}
I am able to get the result.
Could someone please help me on why its failing in the first scenario.

Thanks & Regards,
Ram Prasad G


(David Pilato) #2

If identification.numberOfEmployees.value is a text field, then I believe this is the issue.
You need to change it as a number field.


#3

thank you very much david. that resolved my problem.


(system) #4

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