Search code examples
ruby-on-railselasticsearchrakeseedingelasticsearch-indices

Rails: running my seeds file and elasticsearch throws: more than one indices


So I'm running a large and fairly complicated seeds file. I batch the creation of all types of associated records before batch saving them. I'm running into an issue where I'm given this error:

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] 
{"error":{"root_cause":
[{"type":"illegal_argument_exception","reason":"Alias 
[clients_development] has more than one indices associated with it 
[[clients_development_20170106095823597, 
clients_development_20161123102035835]], can't execute a single index 
op"}],"type":"illegal_argument_exception","reason":"Alias 
[clients_development] has more than one indices associated with it 
[[clients_development_20170106095823597, 
clients_development_20161123102035835]], can't execute a single index 
op"},"status":400}
/Users/

Looks like I have a db issue? Test/dev db, maybe? I've run through a lot of rake commands, but they amount this this bad boy:

rake db:drop && rake db:create && rake db:migrate && rake db:schema:dump && rake db:test:prepare

I run into the same error along the way of this. Any one have an idea on what's going on?


Solution

  • You might try making sure that you don't have Elasticsearch running in more than one place. After that, try reindexing all records:

    rake searchkick:reindex:all