Query to return only when one of the values greater than x but not when another value is also greater than x

Hi, I'm new to Elastic Search and need some help if this query is possible to be done

Value in Table Format:

value1 value2
6000 2000
3000 3000
5000 8000
3002 3001
80 3500

only one of the values can be greater than 3000.
get the query result if only one of value1 or value2 is greater than 3000, but not if both values exceeded 3000

Expected result is something like this:

value1 value2
6000 2000
3000 3000
80 3500

how do i modify this query to get this result?

       "query": {
           "bool": {
              "must":[
                   {"range": {"value1": {"from": 0, "to": 3000}}},
                   {"range": {"value2": {"from": 0, "to": 3000}}},   
               ]
           }
         },

Welcome!

Try

   "query": {
       "bool": {
          "should":[
               {"range": {"value1": {"from": 0, "to": 3000}}},
               {"range": {"value2": {"from": 0, "to": 3000}}},   
           ]
       }
     },

Thank you for the quick reply. this works perfectly
Turned out it's a fairly simple solution.. I need to do more reading with the documentations :laughing:

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