For each shard, you will find one primary and two replicas in your cluster.

As you have 2 shards, you will have 50% of your docs in the first shard

(with 2 copies) and 50 % in the second shard (with 2 copies).

If you have 100 docs using 10 Mb

You will have 30 Mb used in your cluster (if you have enough nodes).

If you have 1 node, your cluster will be yellow and you will have shard0

with 5 Mb and shard1 with 5Mb

If you have 2 nodes, your cluster will be yellow and you will have shard0

primary, shard 1 replica in the first node using 5 Mb each, and shard0

replica and shard 1 primary in the second node using 5 Mb each. So you will

use 20 Mb in your cluster

If you have 3 nodes, your cluster will be green and you will have something

like shard0 primary, shard 1 replica in the first node using 5 Mb each, and

shard0 replica and shard 1 primary in the second node using 5 Mb each and

shard0 replica and shard 1 replica in the third node using 5 Mb each. So you

will use 30 Mb in your cluster

HTH,

David.

De : elasticsearch@googlegroups.com [mailto:elasticsearch@googlegroups.com]

De la part de Vineeth Mohan

Envoyé : jeudi 20 octobre 2011 19:16

À : elasticsearch@googlegroups.com

Objet : Newbie question on shard and replicas

Hi ,

As far as i have explored ES , what i have understood is

- A replica of index will have whole documents and it wud b stored in

that box.
- A shard is a lucene object which holds a part of the whole index.

That is if the number of shards to a index is 5 , first shard will have the

first 20% of the index data , second one will have 20% to 40% of the data

and so on.
- When a search is queries , the query hits all shards , and its

results are aggregated to give the final result.
- One shard should have atleast 1 copy of the whole documents of that

index

My doubt here is if we set 2 shards and 2 replica's , will there be 3 copy

of same index to the same shard (That is total 3 copies of the orginal data)

or total 3 copies of the whole index in the whole cluster ?

Thanks

Vineeth