Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All shards failed

I was working on elastic search and it was working perfectly. Today I just restarted my remote server (Ubuntu). Now I am searching in my indexes, it is giving me this error.

{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed]","status":503} 

I also checked the health. The status is red. Can anyone tell me what's the issue.

like image 843
user3176531 Avatar asked Jan 16 '14 09:01

user3176531


People also ask

How do you fix all shards fail?

All Shards Failed – How to solve this Elasticsearch error. To understand why all shards failed, we recommend you run the Elasticsearch Error Check-Up which can resolve issues that cause many errors related to shards and help prevent this error from happening again.

What is shards in elastic search?

The shard is the unit at which Elasticsearch distributes data around the cluster. The speed at which Elasticsearch can move shards around when rebalancing data, e.g. following a failure, will depend on the size and number of shards as well as network and disk performance.

How does elasticsearch indexing work?

Elasticsearch takes in unstructured data from different locations, stores and indexes it according to user-specified mapping (which can also be derived automatically from data), and makes it searchable. Its distributed architecture makes it possible to search and analyze huge volumes of data in near real time.


1 Answers

It is possible on your restart some shards were not recovered, causing the cluster to stay red.
If you hit:
http://<yourhost>:9200/_cluster/health/?level=shards you can look for red shards.

I have had issues on restart where shards end up in a non recoverable state. My solution was to simply delete that index completely. That is not an ideal solution for everyone.

It is also nice to visualize issues like this with a plugin like:
Elasticsearch Head

like image 51
mconlin Avatar answered Oct 02 '22 11:10

mconlin