简体   繁体   English

Tire-Elasticsearch-如何在创建时跳过索引编制?

[英]Tire - Elasticsearch - how to skip indexing on create?

I' m working on a rails app. 我正在使用Rails应用程序。 using gem tire as a bond for elasticsearch. 使用宝石轮胎作为弹性搜索的纽带。 in a multistep form I would like to index at the end of the procedure. 我想以多步骤形式在过程结束时编制索引。

is there a way of skipping indexing on create. 有没有一种方法可以跳过创建索引。

guess: Post.create( :indexing => false ) or whatever 猜测:Post.create(:indexing => false)或其他

or in tire config say : only index Post with attribute :published set to true 或在轮胎配置中说:仅将属性为:published的索引发布设置为true

Hope I made myself clear. 希望我能说清楚。 thanks in advance for your answers. 预先感谢您的回答。

Cheers. 干杯。

re: your answer above, after_save is called on create too so a better, more general answer to your question (i think) would be to make sure not to include Tire::Model::Callbacks in your model then 回复:您在上面的答案中,after_save在创建时也被调用,因此对您的问题(我认为)的更好,更一般的答案是确保模型中不包括Tire :: Model :: Callbacks,然后

after_create :my_callback

def my_callback
  false
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM