启用Elasticsearch _size字段 [英] Enabling Elasticsearch _size field
问题描述
我的索引中包含超过9,000,000个文档.
I have an index with over 9,000,000 docs.
我已经定义了自己的映射,一切正常.
I have defined my own mapping and everything went fine.
唯一的问题是我忘记启用_size字段,现在我需要它来本地化大尺寸的文档.
The only problem is that I forgot to enable the _size field and now I need it to localize document with a large size.
从文档中我发现,使用带有以下参数的PUT映射API很好:
From the documentation I found that it's just fine to use the PUT mapping API with these parameters:
{
"my_index": {
"_size": {
"enabled": true
}
}
}
- 新映射是否将与已设置的映射合并?
- 是否为已存储的文档启用大小字段?
我有点担心更改映射,因为上次我使用新的分析仪更新设置时,由于分片重定位导致服务出现问题,并且一切卡住了.
I am a little worried making changes to mapping beacuse the last time that I have updated the settings with a new analyzer the service was having problem due to shard relocation and everything got stuck.
推荐答案
映射将被合并,并为 my_index
_size 字段>.
The mappings will be merged OK and the _size
field will be enabled for all your documents of type my_index
.
请注意,如果要存储 _size
(除了仅索引其值),还需要在您的计算机中添加"store":"yes"
_size
映射.
Note that if you want to store the _size
(in addition to just index its value), you also need to add "store": "yes"
in your _size
mapping.
不幸的是,您需要重新索引数据才能正确索引 _size
字段.
Unfortunately, you'll need to re-index your data in order for the _size
field to be properly indexed.
这篇关于启用Elasticsearch _size字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!