'Elastic Search Query not giving the right results
I'm trying to run a query which filters according to date range and should meet either of two criteria.
"query":{
"bool":{
"must":[
{
"nested":{
"query":{
"bool":{
"must":[
{
"range":{
"segment_status.updated_at":{
"from":"2021-08-30",
"to":null,
"include_lower":true,
"include_upper":true,
"boost":1.0
}
}
}
],
"should":[
{
"terms":{
"segment_status.bo_status":[
2,
3,
4
]
}
},
{
"terms":{
"segment_status.fo_status":[
2,
3,
4
]
}
}
],
"adjust_pure_negative":false,
"boost":1.0
}
},
"path":"segment_status",
"ignore_unmapped":false,
"score_mode":"avg",
"boost":1.0
}
}
]
}
}
It's filtering according to the date correctly but I'm getting records that don't match any of the mentioned conditions in should clause.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
