# Default Shard Search preference

**URL:** <https://discuss.elastic.co/t/default-shard-search-preference/51531>\
**Category:** Elasticsearch\
**Created:** [June 1, 2016, 9:05am UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531 "2016-06-01T09:05:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anks](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anks](https://discuss.elastic.co/u/anks)\
**Post date:** [June 1, 2016, 9:05am UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531/1 "2016-06-01T09:05:42Z")

</div>

I am wondering what is default search behavior in term of shard selection.

When a search execute will it either primary or replica shards or use few primary and few replica ?

Please explain.

Thanks!

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [June 1, 2016, 9:49am UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531/2 "2016-06-01T09:49:34Z")

</div>

Hi,

By default, this is randomized between primary and replica shards, but you can control this behaviour using the `preference` parameter: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-preference.html)

---

<div class="post-metadata">

**Author:** ![anks](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anks](https://discuss.elastic.co/u/anks)\
**Post date:** [June 1, 2016, 11:41am UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531/3 "2016-06-01T11:41:50Z")

</div>

> [@cbuescher](#):
>
> randomized between primary and replica shards

Thanks Christoph,

"randomized between primary and replica shards" does not clear my question Whether it is combination primary and replica shards or randomized between any one of two (primary and replica).

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [June 1, 2016, 1:00pm UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531/4 "2016-06-01T13:00:36Z")

</div>

By default, for each shard search can either hit primary or any of the replicas randomly.

---

<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:47pm UTC](https://discuss.elastic.co/t/default-shard-search-preference/51531/5 "2017-07-05T22:47:15Z")

</div>


