DeejUK
DeejUK

Reputation: 13481

ElasticSearch returns when querying new Index

We're getting the following error intermittently when creating and then querying a solitary index as part of an ElasticSearch test:

SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed]

We're using Elasticsearch 0.90.11, and the latest Ruby client. It seemed to happen less frequently when there was only one shard specified in elasticsearch.yml, but we still got the error intermittently.

Upvotes: 1

Views: 100

Answers (1)

DrTech
DrTech

Reputation: 17319

After creating the index, do this:

curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow

That'll wait for the primary shards to be allocated before returning.

Upvotes: 3

Related Questions