Elasticsearch wait_for_status

Writing unit/integration tests for your search code ? If this includes creating an index and adding some data for your tests, the wait_for_status flag might be useful. The API looks like this:

http://localhost:9200/health?wait_for_status=green&timeout=50s

This is a blocking call and will wait till the timeout provided till the status changes. This will definitely be more helpful than sleeping for a while and will help in writing more stable tests.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s