web123456

The usage of must and should in es

GET gather-034-20171225/_search
 {
 "query": {
 "bool": {
 "must": [
           {"range": {
 "recive_time": {
 "gte": "2017-12-25T01:00:00.000Z",
 "lte": "2017-12-25T02:10:00.000Z"
               }
           }},
           {
 "bool": {
 "Should": [
                     {"range": {
 "live_delay": {
 "gte": 1500
                               }
                     }},
                         {
 "range": {
 "stream_break_count.keyword": {
 "gte": 1
                                               }
                               }
                       }
               ]
               }
           }
         ]
     }
   }
 }
 In this case, both conditions of must must be met, and at least one of the two conditions in should be met.
GET /ssa_envents*/nsec/_search
 {
   "query": {
     "bool": {
       "must": [
         {"match": {
           "dPosition": "Beijing"
         }},
         {
           "match": {
             "program": "FILTER"
           }
         }
       ]
     }
   }
 }