【问题标题】:Find all documents where field exists literally: either it has a value or it is null in Elasticsearch查找字段存在的所有文档:在 Elasticsearch 中它有一个值或为空
【发布时间】:2021-02-24 19:53:09
【问题描述】:

我知道如何用非空字段确定Elasticsearch6.8中的文档,例如:

GET grch38_test__wes__grch38__variants__20210222/_search
{
  "query": {
    "bool": {
      "must": [{
        "exists": {
          "field": "hgmd_accession"
        }
      }]
    }
  }
}

但是如何在一个查询中返回现有(非 null)和空值?我需要找到值确实存在的文档:空或设置为 null。我的索引中可能有一些文档根本不存在该字段,我需要 _reindex 那些只是以任何形式存在该字段的文档。

【问题讨论】:

    标签: elasticsearch exists


    【解决方案1】:

    我不认为 null 值可以被搜索,因为它们没有被 elasticsearch 索引。

    如果您可以更改索引映射,那么您应该查看 elasticsearch 提供的 null_value 属性。 在这里找到它:https://www.elastic.co/guide/en/elasticsearch/reference/6.8/null-value.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-02
      • 1970-01-01
      • 2012-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-31
      相关资源
      最近更新 更多