zoukankan      html  css  js  c++  java
  • Elasticsearch判断多列存在、bool条件组合查询示例

    and符号判断多列存在:{
      "filter": {
        "and": [
          {
            "exists": {
              "field": "sid"
            }
          },
          {
            "exists": {
              "field": "level"
            }
          }
        ]
      }
    }

    bool组合

    {
      "filter": {
        "and": [
          {
            "or": [
              {
                "match_phrase": {
                  "displayname": "s"
                }
              },
              {
                "match_phrase": {
                  "displayname": "l"
                }
              }
            ]
          },
          {
            "match_phrase": {
              "displayname": "a"
            }
          },
          {
            "not": {
              "match_phrase": {
                "displayname": "p"
              }
            }
          }
        ]
      }
    }

    注:类似的and符号替换成 bool must实际上结果是一样的;目前ElasticSearch官方推荐写法是使用bool替代之前的and or语句。

  • 相关阅读:
    e3.tree参考手册
    fckeditor使用详解
    提示constructor无法location的原因
    无限联动下拉框使用步骤
    动态sql构建的过程
    xsqlbuilder使用说明
    处理date类型对象的方式
    wdatepicker使用指南
    How to reclaim space in InnoDB when innodb_file_per_table is ON
    Bash script: report largest InnoDB files
  • 原文地址:https://www.cnblogs.com/thaughtZhao/p/5537234.html
Copyright © 2011-2022 走看看