弹性搜索:将分析器/标记器/过滤器设置的更改应用于现有索引

huangapple go评论46阅读模式
英文:

Elastic Search: applying changes of analyzers/tokenizers/filters settings to existing indices

问题

我对ElasticSearch相当新,所以如果我忽视了一些明显/基本的东西,请原谅。

我想要更改分析器/标记器/过滤器的设置,然后将它们应用于现有的索引。我能想到的唯一方法如下:

  1. 创建一个新的索引。
    • 假设您想要更改posts索引的设置,请创建posts-copy索引。
  2. posts重新索引到posts-copy
  3. 删除posts
  4. 重新创建posts索引,并应用新的设置。
  5. posts-copy重新索引到posts
  6. 删除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:

  1. create a new index.
    • Suppose you want to change the setting of posts index, create posts-copy index.
  2. reindex posts to posts-copy.
  3. delete posts.
  4. re-create posts index, applying the new settings.
  5. re-reindex posts-copy to posts.
  6. 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.

huangapple
  • 本文由 发表于 2023年1月9日 11:04:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052828.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定