zoukankan      html  css  js  c++  java
  • ES 中多条件查询 匹配

    近期使用ES做关联查询,实现 a and b and (c1 or c2)and (d1 or d2)的方法 被should 和must搞得晕头转向,后仔细拜读使用说明实现: 

    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 } } },
    ] } },
         {
           "bool": {
                "should": [
               {'term': {'status': {'value': 400}}},
            {'term': {'status': {'value': 500}}}

    ] } }
    ] } } } 这个中,must的两个条件都必须满足,should中的两个条件至少满足一个就可以。
  • 相关阅读:
    在普通类中调用service
    layui util 工具时间戳转换
    最大值
    药房管理
    线段树2
    线段树1
    Dijkstra
    最大值最小化
    图的M 着色问题
    取余运算
  • 原文地址:https://www.cnblogs.com/liang715200/p/15760682.html
Copyright © 2011-2022 走看看