簡體   English   中英

查找字段存在的所有文檔:它有一個值,或者它是 Elasticsearch 中的 null

[英]Find all documents where field exists literally: either it has a value or it is null in Elasticsearch

我知道如何使用非空字段確定Elasticsearch 6.8中的文檔,例如:

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

但是如何在一個查詢中返回現有(非空)和空值? 我需要找到該值確實存在的文檔:空的或設置為 null。 我的索引中可能有一些文檔根本不存在該字段,我需要重新_reindex那些僅以任何形式存在該字段的文檔。

我不認為 null 值可以被搜索,因為它們沒有被 elasticsearch 索引。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM