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

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

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.

Is this feature available in elasticsearch 2.2?

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

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

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