wanted to query two fields (a and b) in 'and' /'or' operators to check ((a > 90 and b >=70 ) or (a>80 and b>98))with another field. Please guide me to write combine multiple query clauses using boolean operators
"""
updaterideid = {
"script": {
"inline": "ctx._source.rid=params.paramsstrid",
"lang": "painless",
"params": {
"paramsstrid": strrid
}
},
"query": {
"bool": {
"must": [
{
"match": {
"_id": strhbid
}
},
{
"match": {
"a":{"lt" : a}
}
},
{
"match": {
"b":{"lt" : b}
}
}
]
}
}
"""
{
"query": {
"bool": {
"filter": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"range": {
"a": {
"gt": 90
}
}
},
{
"range": {
"b": {
"gte": 70
}
}
}
]
}
},
{
"bool": {
"must": [
{
"range": {
"a": {
"gt": 80
}
}
},
{
"range": {
"b": {
"gt": 98
}
}
}
]
}
}
]
}
}
}
}
}
2 Likes
Thank you very much Vinayak_Sapre for your explanation with the coding
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.