Elasticsearch range filter not returning expected data

I have a range data as shown below for each of the products:
"regionRanges": [
{"lowerLimit": "1000", "upperLimit": "1019"},
{"lowerLimit": "1000","upperLimit": "1099"},
{"lowerLimit": "3000","upperLimit": "3099"}
]
and user will be in a specific region (e.g. 1090) so how can i get all the product from a particular region.
I had tried different query but those are not working as expected.

{
"query": {
"bool": {
"must": [
{
"range": {
"custom_attributes.supplier.regionRanges.lowerLimit": {"lt": "1090"}
}
},
{
"range": {
"custom_attributes.supplier.regionRanges.upperLimit": {"gt": "1090"}
}
}
],
"must_not": ,
"should": [{"match_all": {}}]
}
}
}

Could you please help me out in figuring out where the query is getting wrong?
I would like to get all the product which has the user region in their ranges.

Unlike the Price of the product where we give range and return all the products in that range, It's quite opposite like you have the region and get all those products for which this region is available in the product ranges.

See Elastic search range query not working

on top of that, you should look at the nested datatype in order to get the correct results back.

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