更新生产中的ElasticSearch映射(轮胎) [英] Update ElasticSearch mapping in production (Tire)
问题描述
我想对如何处理以下情况有一个清楚的了解:
I would like to have a clear understanding on how to deal with the following scenario:
我正在添加或删除一个属性从一个activerecord模型,所以我想更新其在生产中的ElasticSearch的映射。
I'm adding or removing an attribute from an activerecord model, so I want to update its mapping in ElasticSearch, in production.
从我的理解,我应该..
From what I understood, I should...
这是正确的命令吗? rake environment轮胎:import CLASS ='Bow'INDEX ='new-bows'
为了创建正确的映射,我应该已经更新了我的映射模型,对吗?
Is this the right command? rake environment tire:import CLASS='Bow' INDEX='new-bows'
For this to create the right mapping, I should already have updated my mapping in the model, right?
我会这样做,是否正确?
I would do it like that, is it correct?
old_index_name = Bow.tire.index.name
Bow.tire.index.delete
alias = Tire::Alias.new
alias.name(old_index_name)
alias.index('new-bows')
alias.save
3-重新启动应用程序
我错过了一些东西,还是有一个更简单的方法来实现我想要使用轮胎?
我应该在什么时候删除旧的索引?在创建具有相同名称的别名之前,或者可以在以后执行别名?
推荐答案
索引,直到你确定新的索引是100%你想要的。
You should keep the old index around until you're sure the new index is 100% what you want. You can flip the alias back if that would not be the case.
Tire测试套件中有一个集成测试,用于翻转别名。
There's an integration test in Tire test suite for "flipping aliases".
这篇关于更新生产中的ElasticSearch映射(轮胎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!