I have two entity like User & Activity. Activity contains filed ageGroup like ["10:20","25:30"] & user entity contained age field . consider user age is 26 so he/she is eligible for that activity. I want to fetch all those activities which satisfied above conditions
GET _search
{
"query": {
"bool": {
"filter": {
"range": {
"ageGroup": {
"gte": 50,
"lte": 55
}
},
"term": {"****": "M"}
},
"must": [
{
"term": {"******": {"value": "15"}}
}
] ,"should": [
{
"match": {"******": "7"}
},
{
"match": {"******": "1"}
}
]
}
}
}
You can also use integer_range data type to verify value within range or not https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html