英文:
Elastic Search: applying changes of analyzers/tokenizers/filters settings to existing indices
问题
我对ElasticSearch相当新,所以如果我忽视了一些明显/基本的东西,请原谅。
我想要更改分析器/标记器/过滤器的设置,然后将它们应用于现有的索引。我能想到的唯一方法如下:
- 创建一个新的索引。
- 假设您想要更改
posts
索引的设置,请创建posts-copy
索引。
- 假设您想要更改
- 将
posts
重新索引到posts-copy
。 - 删除
posts
。 - 重新创建
posts
索引,并应用新的设置。 - 将
posts-copy
重新索引到posts
。 - 删除
posts-copy
。
我尝试过使用ElasticSearch的Ruby客户端这种方式,看起来似乎有效。然而,我不确定这种方法是否真的适当。我觉得这种方法相当冗余,可能有更有效的应用新设置的方式。
如果您能为这个问题提供一些指导,我将不胜感激。
英文:
I'm quite new to ElasticSearch, so please forgive me if I overlook something obvious/basic.
I'd like to change the settings of analyzers/tokenizers/filters, and then apply them to existing indices. The only way I can come up with is the following:
- create a new index.
- Suppose you want to change the setting of
posts
index, createposts-copy
index.
- Suppose you want to change the setting of
- reindex
posts
toposts-copy
. - delete
posts
. - re-create
posts
index, applying the new settings. - re-reindex
posts-copy
toposts
. - delete
posts-copy
.
I tried this way using Ruby client of ElasticSearch, and it looked like it worked. However, I'm not sure if this approach really is proper. And I feel like it's quite redundant and there might be more efficient way of applying new settings.
I would appreciate it if you shed some lights on this problem.
答案1
得分: 1
这取决于您对analyzers/tokenizers/filters
进行的更改类型。如果您在现有字段上进行更改,那么这些是破坏性更改,您需要使用新的设置重新创建索引(正如您所提到的)。但如果您正在索引中添加新字段并为此创建新设置,那么您不需要重新创建索引,这被称为增量更改。
希望这有所帮助。
英文:
It depends what type of changes are you doing on analyzers/tokenizers/filters
, if you are changing it on existing fields than these are breaking changes and you have to recreate the indices with new settings(like you mentioned), but if you are adding a new fields in the index and for that you are creating new settings, than you don't have to recreate the index, its called incremental changes.
Hope this helps.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论