zoukankan      html  css  js  c++  java
  • Elasticsearch 多条件查询

    查询 organization_id 为 208 和 event_type 为 007 的数据

    curl -X GET 10.44.99.102:9200/situation-event/_search?pretty -d 
    {
        "query": {
            "bool": {
                "must": [{
                    "term": {
                        "organization_id": "208"
                    }
                }, {
                    "term": {
                        "event_type": "007"
                    }
                }]
            }
        }
    }

    查询 organization_id 为 208 和 event_type 为 007 或者 008 的数据

    curl -X GET 10.44.99.102:9200/situation-event/_search?pretty -d 
    {
        "query": {
            "bool": {
                "must": [{
                    "match_phrase": {
                        "organization_id": "208"
                    }
                }],
                "should": [{
                        "match_phrase": {
                            "event_type": "007"
                        }
                    },
                    {
                        "match_phrase": {
                            "event_type": "008"
                        }
                    }
                ],
                "minimum_should_match": 1
            }
        }
    }

      

     1 curl -X GET 10.44.99.102:9200/situation-event/_search?pretty -d 
     2 {
     3     "query": {
     4         "bool": {
     5             "must": [{
     6                 "term": {
     7                     "organization_id": "208"
     8                 }
     9             }],
    10             "should": [{
    11                     "terms": {
    12                         "event_type": ["007", "008"]
    13                     }
    14                 }
    15             ],
    16             "minimum_should_match": 1
    17         }
    18     }
    19 }
    多条件查询
  • 相关阅读:
    注册审核
    静态表单验证
    多条件查询
    0623TP框架联系
    0618框架 增删改练习
    php框架 数据添加
    0616框架查询
    0614空操作方法 空控制器 跨控制器调用 命名空间
    php 0613框架基础
    php查询
  • 原文地址:https://www.cnblogs.com/shangwei/p/13530429.html
Copyright © 2011-2022 走看看