Hello Magento Friends,
Today I will give you the solution for the most common error, the reindex issue with Elasticsearch.
When there is a change in data in your database you need to run the reindex command to update the rows and columns. But when you run the below reindex command
bin/magento indexer:reindex
An error is shown in the terminal as follows:
Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:05 Category Flat Data index has been rebuilt successfully in 00:00:00 Category Products index has been rebuilt successfully in 00:00:06 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:09 Stock index has been rebuilt successfully in 00:00:04 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:01:57 Google Product Removal Feed index has been rebuilt successfully in 00:00:00 Google Product Feed index has been rebuilt successfully in 00:00:00 Catalog Search index process unknown error: {"error":{"root_cause":[{"type":"cluster_block_exception","reason":"index [magento2_product_1_v1516] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"}],"type":"cluster_block_exception","reason":"index [magento2_product_1_v1516] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"},"status":429}
This error means you do not have enough disk space to store or update data. The flood storage watermark is 95% default, so when it exceeds, the above error is shown and it puts the Elasticsearch into read-only mode. So you need to free up disk space or enlarge it.
Let’s get the solution for the above error in Magento 2.
Steps to Solve Reindex issue with Elasticsearch:
Step 1: From the terminal go to Magento Root path and run the below command:
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
Step 2: After this again run the reindex command in the terminal and check.
bin/magento indexer:reindex
Conclusion:
This way you can solve the reindex error for Elasticsearch. If you face any difficulty, feel free to share with me via the comment box. Moreover, check out other related articles and solutions for reindexing in Magento 2.
- How to perform Reindexing Programmatically in Magento 2
- Magento 2: How to Flush the Cache and Reindex from Command Line
- How to Unlock Reindex Process in Magento 2
Share the solution with your fellow Magento developers to help them get rid of the error. See you with my next article till then stay in touch.
Happy Coding!