meilisearch / meilisearch-rails

Meilisearch integration for Ruby on Rails
https://www.meilisearch.com
MIT License
295 stars 48 forks source link

Index already exists error #322

Open jeremylynch opened 7 months ago

jeremylynch commented 7 months ago

We are frequently seeing this error in our tasks:

Error: {"message"=>"Index `Car_production` already exists.", "code"=>"index_already_exists", "type"=>"invalid_request", "link"=>"https://docs.meilisearch.com/errors#index_already_exists"}

We are not entirely sure why meilisearch rails is trying to recreate the index every 10-20 minutes?

Meilisearch 1.6.0, meilisearch rails 0.10.2

ellnix commented 7 months ago

... in our tasks:

Presumably this means background tasks? If possible please provide information on the task that is causing this, if you can narrow it down.

If not, I'll try to find the cause anyway.

jeremylynch commented 7 months ago

We are actually not using background tasks to handle meilisearch indexing, just indexing straight to Meilisearch (using meilisearch-rails).

What additional details of the task would you like?

ellnix commented 7 months ago

Is this error appearing in your Rails logs or other logs?

meilisearch-rails does indeed not check with the server before attempting to create an index, so in many cases it tries to create an index that is already there, which normally just fails silently.

jeremylynch commented 7 months ago

This is occuring in the meilisearch tasks. If an indexation fails in this way, will a document potentially not get indexed?

Can these failing tasks be ignored?

curquiza commented 6 months ago

Hello @jeremylynch We have difficulties to exactly reproduce your issue, but we just released v0.12.0 of Meilisearch rails. Does it help?

jeremylynch commented 6 months ago

Will test and report back

jeremylynch commented 6 months ago

Confirming we are still seeing the error on v0.12.0

Error: {"message"=>"Index `Page_production` already exists.", "code"=>"index_already_exists", "type"=>"invalid_request", "link"=>"https://docs.meilisearch.com/errors#index_already_exists"}
ellnix commented 6 months ago

This is occuring in the meilisearch tasks. If an indexation fails in this way, will a document potentially not get indexed?

Can these failing tasks be ignored?

If these errors are only on the meilisearch tasks on the instance, and you do not see them in your Rails logs, you can freely ignore them. They are just a side effect of how meilisearch-rails communicates with the server.

This is still polluting the tasks on the server so I will look into an alternative implementation.