zoukankan      html  css  js  c++  java
  • 存在与否检索 exists query

    返回包含字段索引值的文档。

    由于多种原因,文档字段的索引值可能不存在:

    • 源JSON中的字段是null[]
    • 该字段已"index" : false在映射中设置
    • 字段值的长度超出ignore_above了映射中设置
    • 字段值格式错误,并且ignore_malformed已在映射中定义
    curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
    {
      "query": {
        "exists": {
          "field": "user"
        }
      }
    }
    '

    要查找缺少字段索引值的文档,请 查询中使用must_not exists查询。

    以下搜索返回缺少该user.id字段的索引值的文档

    curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
    {
      "query": {
        "bool": {
          "must_not": {
            "exists": {
              "field": "user.id"
            }
          }
        }
      }
    }
    '
  • 相关阅读:
    1
    iulg
    实验10
    作业5 指针应用
    作业4 函数应用
    实验9 指针
    实验 8 数组2
    实验7
    实验6 数组1
    实验5
  • 原文地址:https://www.cnblogs.com/Mint-diary/p/14498234.html
Copyright © 2011-2022 走看看