# Clarification on setWaitForActiveShards method

**URL:** <https://discuss.elastic.co/t/clarification-on-setwaitforactiveshards-method/55703>\
**Category:** Elasticsearch\
**Created:** [July 17, 2016, 9:35pm UTC](https://discuss.elastic.co/t/clarification-on-setwaitforactiveshards-method/55703 "2016-07-17T21:35:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dadepo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadepo/32/19944_2.png) [@dadepo](https://discuss.elastic.co/u/dadepo)\
**Post date:** [July 17, 2016, 9:35pm UTC](https://discuss.elastic.co/t/clarification-on-setwaitforactiveshards-method/55703/1 "2016-07-17T21:35:21Z")

</div>

I would appreciate if someone who knows can clarify the exact semantics of `ClusterHealthRequestBuilder# setWaitForActiveShards(int waitForActiveShards)` method.

Is the `waitForActiveShards` argument the number of seconds to wait for an active shard before giving up or something?

or it the number of shard to wait to become active before proceeding?

And what exactly is the operation being in "wait" for?

So let's say:

1. programmatically I create an Index,
2. then I set waitForActiveShards to 1
3. then I query the index

I am guessing step 3 would be delayed based on the semantics of step 2?  
Is it actually delayed? or the operation in step 3 is "buffered" up?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:34pm UTC](https://discuss.elastic.co/t/clarification-on-setwaitforactiveshards-method/55703/2 "2017-07-05T22:34:55Z")

</div>


