gpt4 book ai didi

elasticsearch - Elasticsearch从映射中删除 “one level”

转载 作者:行者123 更新时间:2023-12-03 00:42:08 25 4
gpt4 key购买 nike

我需要破坏索引映射。

我的索引具有以下映射

  "A": {
"properties": {
"B": {
"properties": {
-c
-d
-e
}
}
}
}

我需要删除“一级”以具有这样的映射:
 "A": {
"properties": {
-c
-d
-e
}
}

是否可以在不重新索引所有数据的情况下获得此结果?

最佳答案

简短答案,编号
更长的答案,也是这个问题已经被问了很多遍了。答案将始终是“否”,这就是为什么:

You can only find that which is stored in your index. In order to make your data searchable, your database needs to know what type of data each field contains and how it should be indexed. If you switch a field type from e.g. a string to a date, all of the data for that field that you already have indexed becomes useless. One way or another, you need to reindex that field.

This applies not just to Elasticsearch, but to any database that uses indices for searching. And if it isn't using indices then it is sacrificing speed for flexibility.

Elasticsearch (and Lucene) stores its indices in immutable segments — each segment is a “mini" inverted index. These segments are never updated in place. Updating a document actually creates a new document and marks the old document as deleted. As you add more documents (or update existing documents), new segments are created. A merge process runs in the background merging several smaller segments into a new big segment, after which the old segments are removed entirely.

Typically, an index in Elasticsearch will contain documents of different types. Each _type has its own schema or mapping. A single segment may contain documents of any type. So, if you want to change the field definition for a single field in a single type, you have little option but to reindex all of the documents in your index.


如果您对更多信息感兴趣,可以阅读Clinton Gormley的其余摘录 here
我还建议以下阅读:
  • Elasticsearch Zero Downtime Reindexing – Problems and Solutions
  • SO问题:Is there a smarter way to reindex elasticsearch?
  • 关于elasticsearch - Elasticsearch从映射中删除 “one level”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34879675/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com