Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch wait for index status

Cluster health API has parameter wait_for_status that (according to documentation) waits for specified cluster status. However, I would like to wait for specific index to reach some status.

If I use cluster health request with level=indices and index=myindex will the wait still operate on cluster level? I guess polling the status and continuing after status is reached would have the same effect but is there better way to do this?

like image 248
Mika Lammi Avatar asked Sep 04 '15 06:09

Mika Lammi


People also ask

How do I refresh Elasticsearch index?

By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds. You can change this default interval using the index. refresh_interval setting.

How do I get Elasticsearch status?

Verify elasticsearch is running by typing $ smarts/bin/sm_service show. 2. Verify elasticsearch is serving requests from a browser on the same machine in Windows or using a tool like curl on Linux. A page specific to the browser will appear.

What is flush index in Elasticsearch?

Flushing a data stream or index is the process of making sure that any data that is currently only stored in the transaction log is also permanently stored in the Lucene index.


1 Answers

It is possible to use the health api for specific indices, as well:

GET /_cluster/health/index_name?wait_for_status=green&timeout=10s
like image 153
Andrei Stefan Avatar answered Nov 15 '22 05:11

Andrei Stefan