繁体   English   中英

从 Elasticsearch 7 索引映射中删除一个字段

[英]Remove a field from Elasticsearch 7 index mapping

我正在使用 elasticsearch 7.10 并具有如下映射的索引:

{
  "test_index" : {
    "mappings" : {
      "properties" : {
        "packages" : {
          "type" : "nested",
          "include_in_root" : true,
          "properties" : {
            "amount" : {
              "type" : "text",
              "fields" : {
                "raw" : {
                  "type" : "double"
                }
              }
            },
            "rem_amount" : {
              "type" : "keyword",
              "fields" : {
                "raw" : {
                  "type" : "double"
                }
              }
            }
          }
        }
      }
    }
  }
}

我还使用上述映射将一些文档索引到索引中。 现在我想从映射和相关文档中删除字段“rem_amount”。

有什么方法可以更新映射以删除字段而不重新索引整个索引?

弹性搜索放置映射 API 文档没有提到任何这样的事情,我想知道这是否可能。 https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html

早在 2016 年就有人问过类似的问题,但想知道是否对无需重新索引即可删除字段的方式进行了任何更改。

不,您不能,仍然无法从映射中删除字段,唯一的方法是重新索引。

您绝对可以使用_update_by_query API从所有文档中删除该字段,但该字段将保留在映射中。 不过,我不确定在映射中仍然有一个没有文档的字段会有多大问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM