Yesterday, I worked on elasticsearch integration with help of searchkick.
I did several times adding searchkick to Rails projects but never got this error before:
`__raise_transport_error': [400] {"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [house_development_20240902225059955/3Jvd0sYAT46lRDc8O-CgDQ] already exists"
This error was raised when I ran
MyModel.reindex
From the error description, I can say the problem is index
already exists and failed to recreate the index
. So I tried to delete the index using curl
,
show all indexes.
curl http://elastic:ELASTICSEARCH_PASSSWORD@127.0.0.1:9200/_aliases?pretty=true
delete index.
curl -X DELETE http://elastic:CbHBbB9PS5xYB5RdOTQP@127.0.0.1:9200/house_development_20240902225059955
After that, then I tried to call MyModel.reindex
again, but the same error still happened.
Then I tried to check the elasticsearch server log and got this:
high disk watermark [90%] exceeded on [WPlL99sKQ7CnX59V0PiC-Q][cc376a2237d1][/usr/share/elasticsearch/data] free: 47.2gb[9.9%], shards will be relocated away from this node; currently relocating away shards totalling [0] bytes; the node is expected to continue to exceed the high disk watermark when these relocations are complete
After googling, I found this SO question, and just tried to change threshold_enabled
that made indexing back to work.
curl -XPUT "http://elastic:ELASTICSEARCH_PASSSWORD@127.0.0.1:9200/_cluster/settings" \
-H 'Content-Type: application/json' -d'
{
"persistent": {
"cluster": {
"routing": {
"allocation.disk.threshold_enabled": false
}
}
}
}'
Hope this helps for you.
Top comments (0)