2017-02-11 8 views
0

に私は名前俳優でモデルを持っているし、モデルは次のスニペットのlib/searchkick/model.rb:70: `searchkick_reindex」

class Actor 
     include Mongoid::Document 
     field :name, type: String 
     field :birthName, as: :birth_name, type: String 
     field :date_of_birth, type: Date 
     field :height, type: Measurement 
     field :bio, type: String 
    searchkick 
end 

私はActor.reindexを使用して、私のモデルのインデックスを再作成しようとするようになります。私はインデックスが既に存在するとして根本的な原因を示し、次のエラーを取得しています。

irb(main):001:0> Actor.reindex 
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"index [actors_development_20170209175219593/TKOPkMY1TsGNEYmWlVCKo 
A] already exists","index_uuid":"TKOPkMY1TsGNEYmWlVCKoA","index":"actors_development_20170209175219593"}],"type":"index_already_exists_exception","reason":"index [actors_development_20170209175219593/TKO 
PkMY1TsGNEYmWlVCKoA] already exists","index_uuid":"TKOPkMY1TsGNEYmWlVCKoA","index":"actors_development_20170209175219593"},"status":400} 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-transport-5.0.1/lib/elasticsearch/transport/transport/base.rb:201:in `__raise_transport_error' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-transport-5.0.1/lib/elasticsearch/transport/transport/base.rb:318:in `perform_request' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-transport-5.0.1/lib/elasticsearch/transport/transport/http/faraday.rb:20:in `perform_request' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-transport-5.0.1/lib/elasticsearch/transport/client.rb:128:in `perform_request' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-api-5.0.1/lib/elasticsearch/api/namespace/common.rb:21:in `perform_request' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/elasticsearch-api-5.0.1/lib/elasticsearch/api/actions/indices/create.rb:86:in `create' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/searchkick-2.1.1/lib/searchkick/index.rb:14:in `create' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/searchkick-2.1.1/lib/searchkick/index.rb:177:in `create_index' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/searchkick-2.1.1/lib/searchkick/index.rb:226:in `reindex_scope' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/searchkick-2.1.1/lib/searchkick/model.rb:70:in `searchkick_reindex' 
     from (irb):1 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
     from /home/ravi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'from bin/rails:4:in `require' 

エラーがインデックスが既にの存在見せているので、私はelasticsearchからインデックスを削除して、再度実行しようとしたが、インデックスがすでに

は誰缶存在する私に同じエラーを与えていますこのエラーの後ろ

おかげで、 ラヴィの理由を見つけるために助けてください。

答えて

0

は、デバッグの多くの後、私はそのエラーの背後にある理由を見つけました。

私は私のトランスポート・エラーを与えているElasticsearchのv.5.0.1 ...とSearchkick 2.1.1を使用しています。それが適切にインデックス作成を開始し.Then

は、それから私は、v2.4.3でElasticsearchのバージョン5.0.1を置き換えます。私はsearchkick 2.1.1とElasticsearchのバージョン5.0.1

間の互換性の問題があると思います
関連する問題