# How to distribute shards to different AZ's for replication?

**URL:** <https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621>\
**Category:** Elasticsearch\
**Created:** [April 7, 2016, 4:25am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621 "2016-04-07T04:25:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulcse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulcse/32/12158_2.png) [@rahulcse](https://discuss.elastic.co/u/rahulcse)\
**Post date:** [April 7, 2016, 4:25am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/1 "2016-04-07T04:25:48Z")

</div>

Hi, we are trying to distribute shards to 3 available Az's at Amazon.  
Please let me know how can we achieve this, for replication and availability.  
So we want shard1 to go in az1 and then to az2 and then to az3 etc.

Thanks in advance for your inputs.

Regards,  
Rahul

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 7, 2016, 4:51am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/2 "2016-04-07T04:51:29Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/reference/2.3/allocation-awareness.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/allocation-awareness.html)

But you cannot guarantee that shard1 will always live in AZ1, just that the shards will be balanced.

---

<div class="post-metadata">

**Author:** ![rahulcse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulcse/32/12158_2.png) [@rahulcse](https://discuss.elastic.co/u/rahulcse)\
**Post date:** [April 7, 2016, 5:28am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/3 "2016-04-07T05:28:48Z")

</div>

Is this feature available in elasticsearch 2.2?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 7, 2016, 5:30am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/4 "2016-04-07T05:30:59Z")

</div>

Yes, it's been around for a while now.

---

<div class="post-metadata">

**Author:** ![rahulcse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulcse/32/12158_2.png) [@rahulcse](https://discuss.elastic.co/u/rahulcse)\
**Post date:** [April 7, 2016, 5:36am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/5 "2016-04-07T05:36:50Z")

</div>

thank you for all your inputs.

one question is regarding a query:

we are trying to query 3 fields for a given text.  
3 fields are body, title and raw-body (not analyzed). title is of the most importance and then the body and raw-body. if thing matches exactly with raw-body we want it to be ranked higher. Also if matches are identical in 2 documents we want to use decay function based on doc creation date.

Can you please give me some idea how we can write this complicated query?

Thanks in advance.

Regards,  
Rahul

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 7, 2016, 5:46am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/6 "2016-04-07T05:46:20Z")

</div>

It'd be better if you created a new thread for that, then others might be able to help.

---

<div class="post-metadata">

**Author:** ![rahulcse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahulcse/32/12158_2.png) [@rahulcse](https://discuss.elastic.co/u/rahulcse)\
**Post date:** [April 7, 2016, 5:54am UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/7 "2016-04-07T05:54:22Z")

</div>

> [@Query suggestion multi fields + raw field and with results new created boosted](https://discuss.elastic.co/t/query-suggestion-multi-fields-raw-field-and-with-results-new-created-boosted/46625):
>
> Hi, we are trying to query 3 fields for a given text. 3 fields are body, title and raw-body (not analyzed). title is of the most importance and then the body and raw-body. if thing matches exactly with raw-body we want it to be ranked higher. Also if matches are identical in 2 documents we want to use decay function for promotion of fresh content. Can you please give me some idea how we can write this complicated query? Thanks in advance. Regards, Rahul

---

<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, 11:01pm UTC](https://discuss.elastic.co/t/how-to-distribute-shards-to-different-azs-for-replication/46621/8 "2017-07-05T23:01:38Z")

</div>


