I am not sure it is a perfect platform to discuss a issue. If not then just please ignore this mail.
I am trying to search a numeric expression inside a field indexed as string in elastic search.
Example
indent code 4.8663 spaces
indent code 121.232 spaces
indent code 12.3232 spaces
Example query
get all string with "indent code between 1 and 100"
It should get 1st and 3rd but not 2nd.
For this purpose I tried using span_near query with range in span_multi.
{
"span_near": {
"in_order": 1,
"clauses": [
{
"span_term": {
"request": "indent"
}
},
{
"span_term": {
"request": "code"
}
}
,
{
"span_multi": {
"match":{
"range": {
"request": {
"to": 100,
"from": 1
}
}
}
}
}
],
"slop": 0,
"collect_payloads": 0
}
}
It is getting result but wrong result, as it is comparing using TermRangeQuery rather than NumericRangeQuery
Any help would be appreciated. Also please let me know any other approach if possible.