# Shard

**URL:** <https://discuss.elastic.co/t/shard/5745>\
**Category:** Elasticsearch\
**Created:** [November 2, 2011, 8:29am UTC](https://discuss.elastic.co/t/shard/5745 "2011-11-02T08:29:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [November 2, 2011, 8:29am UTC](https://discuss.elastic.co/t/shard/5745/1 "2011-11-02T08:29:35Z")

</div>

Hi,  
I am kind of new to this project.I have some doubts regarding  
Shard,replica and index.

As per as i know  
1.When we create 10k index with 2 shards and 1 replica on node 1 ,then  
if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
well..  
2.On node 1, 2 shards will be created each shard having 5k memory.  
Can u please clarify me whether above two scenarios are correct?

What is the concept behind creating more than one shard on single  
node or on multiple nodes?

Its better if u tell any documents on basics of elastic search.

Thanks,  
Kalyan.

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [November 2, 2011, 9:00am UTC](https://discuss.elastic.co/t/shard/5745/2 "2011-11-02T09:00:34Z")

</div>

A complete index is broken up into shards.

So if you have 10k documents in a index , and you assign 2 shards and 0  
replica , 5k documents will sit on one node , and the rest of 5k document  
will sit on the next node.

When a search request comes , the request is applied on both nodes and the  
result is merged to obtain the final result.  
Thus depending on the size of your index , you need to specify the number  
of shards.

If you increase the replica , a copy of data in each node is stored in some  
other node too. (This is to make sure even if one node goes down , you get  
to have the entire data)

Also one thing to remember here ,- you cant increase the number of shards  
after you set it for a index. But you can increase number of replica.

Thanks  
Vineeth

On Wed, Nov 2, 2011 at 1:59 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:

> Hi,  
> I am kind of new to this project.I have some doubts regarding  
> Shard,replica and index.
> 
> As per as i know  
> 1.When we create 10k index with 2 shards and 1 replica on node 1 ,then  
> if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
> well..  
> 2.On node 1, 2 shards will be created each shard having 5k memory.  
> Can u please clarify me whether above two scenarios are correct?
> 
> What is the concept behind creating more than one shard on single  
> node or on multiple nodes?
> 
> Its better if u tell any documents on basics of Elasticsearch.
> 
> Thanks,  
> Kalyan.

---

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [November 2, 2011, 9:23am UTC](https://discuss.elastic.co/t/shard/5745/3 "2011-11-02T09:23:49Z")

</div>

Thanks Vineeth,

As u said,If I mention 2 shards(0 replica),then I must have 2 nodes so  
that my 10k data can be shared on two nodes?

On Nov 2, 2:00 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:

> A complete index is broken up into shards.
> 
> So if you have 10k documents in a index , and you assign 2 shards and 0  
> replica , 5k documents will sit on one node , and the rest of 5k document  
> will sit on the next node.
> 
> When a search request comes , the request is applied on both nodes and the  
> result is merged to obtain the final result.  
> Thus depending on the size of your index , you need to specify the number  
> of shards.
> 
> If you increase the replica , a copy of data in each node is stored in some  
> other node too. (This is to make sure even if one node goes down , you get  
> to have the entire data)
> 
> Also one thing to remember here ,- you cant increase the number of shards  
> after you set it for a index. But you can increase number of replica.
> 
> Thanks  
> Vineeth
> 
> On Wed, Nov 2, 2011 at 1:59 PM, kalyan [kalyanc...@gmail.com](mailto:kalyanc...@gmail.com) wrote:
> 
> > Hi,  
> > I am kind of new to this project.I have some doubts regarding  
> > Shard,replica and index.
> 
> > As per as i know  
> > 1.When we create 10k index with 2 shards and 1 replica on node 1 ,then  
> > if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
> > well..  
> > 2.On node 1, 2 shards will be created each shard having 5k memory.  
> > Can u please clarify me whether above two scenarios are correct?
> 
> > What is the concept behind creating more than one shard on single  
> > node or on multiple nodes?
> 
> > Its better if u tell any documents on basics of Elasticsearch.
> 
> > Thanks,  
> > Kalyan.

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [November 2, 2011, 9:40am UTC](https://discuss.elastic.co/t/shard/5745/4 "2011-11-02T09:40:33Z")

</div>

You need not , it fills into available space (as far as i know).

If there is only 1 node and specified shard is 2 , it compromises with a  
single node.  
If another node is added to the cluster at any time , it repartition to 2  
nodes automatically.

Thanks  
VIneeth

On Wed, Nov 2, 2011 at 2:53 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:

> Thanks Vineeth,
> 
> As u said,If I mention 2 shards(0 replica),then I must have 2 nodes so  
> that my 10k data can be shared on two nodes?
> 
> On Nov 2, 2:00 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:
> 
> > A complete index is broken up into shards.
> > 
> > So if you have 10k documents in a index , and you assign 2 shards and 0  
> > replica , 5k documents will sit on one node , and the rest of 5k document  
> > will sit on the next node.
> > 
> > When a search request comes , the request is applied on both nodes and  
> > the  
> > result is merged to obtain the final result.  
> > Thus depending on the size of your index , you need to specify the number  
> > of shards.
> > 
> > If you increase the replica , a copy of data in each node is stored in  
> > some  
> > other node too. (This is to make sure even if one node goes down , you  
> > get  
> > to have the entire data)
> > 
> > Also one thing to remember here ,- you cant increase the number of shards  
> > after you set it for a index. But you can increase number of replica.
> > 
> > Thanks  
> > Vineeth
> > 
> > On Wed, Nov 2, 2011 at 1:59 PM, kalyan [kalyanc...@gmail.com](mailto:kalyanc...@gmail.com) wrote:
> > 
> > > Hi,  
> > > I am kind of new to this project.I have some doubts regarding  
> > > Shard,replica and index.
> > 
> > > As per as i know  
> > > 1.When we create 10k index with 2 shards and 1 replica on node 1 ,then  
> > > if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
> > > well..  
> > > 2.On node 1, 2 shards will be created each shard having 5k memory.  
> > > Can u please clarify me whether above two scenarios are correct?
> > 
> > > What is the concept behind creating more than one shard on single  
> > > node or on multiple nodes?
> > 
> > > Its better if u tell any documents on basics of Elasticsearch.
> > 
> > > Thanks,  
> > > Kalyan.

---

<div class="post-metadata">

**Author:** ![BARNEY](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@BARNEY](https://discuss.elastic.co/u/BARNEY)\
**Post date:** [November 2, 2011, 10:14am UTC](https://discuss.elastic.co/t/shard/5745/5 "2011-11-02T10:14:14Z")

</div>

Ok thanks,  
Now can u tell me,how can I come to know that how many files can be stored  
in Elasticsearch?  
Please explain with one use case like if i have some memory and created 10  
shards 2 replicas(for example)....?

thanks,  
kalyan  
On Wed, Nov 2, 2011 at 3:10 PM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:

> You need not , it fills into available space (as far as i know).
> 
> If there is only 1 node and specified shard is 2 , it compromises with a  
> single node.  
> If another node is added to the cluster at any time , it repartition to 2  
> nodes automatically.
> 
> Thanks  
> VIneeth
> 
> On Wed, Nov 2, 2011 at 2:53 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:
> 
> > Thanks Vineeth,
> > 
> > As u said,If I mention 2 shards(0 replica),then I must have 2 nodes so  
> > that my 10k data can be shared on two nodes?
> > 
> > On Nov 2, 2:00 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:
> > 
> > > A complete index is broken up into shards.
> > > 
> > > So if you have 10k documents in a index , and you assign 2 shards and 0  
> > > replica , 5k documents will sit on one node , and the rest of 5k  
> > > document  
> > > will sit on the next node.
> > > 
> > > When a search request comes , the request is applied on both nodes and  
> > > the  
> > > result is merged to obtain the final result.  
> > > Thus depending on the size of your index , you need to specify the  
> > > number  
> > > of shards.
> > > 
> > > If you increase the replica , a copy of data in each node is stored in  
> > > some  
> > > other node too. (This is to make sure even if one node goes down , you  
> > > get  
> > > to have the entire data)
> > > 
> > > Also one thing to remember here ,- you cant increase the number of  
> > > shards  
> > > after you set it for a index. But you can increase number of replica.
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Wed, Nov 2, 2011 at 1:59 PM, kalyan [kalyanc...@gmail.com](mailto:kalyanc...@gmail.com) wrote:
> > > 
> > > > Hi,  
> > > > I am kind of new to this project.I have some doubts regarding  
> > > > Shard,replica and index.
> > > 
> > > > As per as i know  
> > > > 1.When we create 10k index with 2 shards and 1 replica on node 1 ,then  
> > > > if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
> > > > well..  
> > > > 2.On node 1, 2 shards will be created each shard having 5k memory.  
> > > > Can u please clarify me whether above two scenarios are correct?
> > > 
> > > > What is the concept behind creating more than one shard on single  
> > > > node or on multiple nodes?
> > > 
> > > > Its better if u tell any documents on basics of Elasticsearch.
> > > 
> > > > Thanks,  
> > > > Kalyan.

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)\
**Post date:** [November 2, 2011, 10:53am UTC](https://discuss.elastic.co/t/shard/5745/6 "2011-11-02T10:53:44Z")

</div>

It depends on the machine where the node is running.  
I guess the node keeps on adding documents until the disk is full.

Thanks  
Vineeth

On Wed, Nov 2, 2011 at 3:44 PM, kalyan chowdary [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com)wrote:

> Ok thanks,  
> Now can u tell me,how can I come to know that how many files can be stored  
> in Elasticsearch?  
> Please explain with one use case like if i have some memory and created 10  
> shards 2 replicas(for example)....?
> 
> thanks,  
> kalyan
> 
> On Wed, Nov 2, 2011 at 3:10 PM, Vineeth Mohan [vineethmohan@algotree.com](mailto:vineethmohan@algotree.com)wrote:
> 
> > You need not , it fills into available space (as far as i know).
> > 
> > If there is only 1 node and specified shard is 2 , it compromises with a  
> > single node.  
> > If another node is added to the cluster at any time , it repartition to 2  
> > nodes automatically.
> > 
> > Thanks  
> > VIneeth
> > 
> > On Wed, Nov 2, 2011 at 2:53 PM, kalyan [kalyanc007@gmail.com](mailto:kalyanc007@gmail.com) wrote:
> > 
> > > Thanks Vineeth,
> > > 
> > > As u said,If I mention 2 shards(0 replica),then I must have 2 nodes so  
> > > that my 10k data can be shared on two nodes?
> > > 
> > > On Nov 2, 2:00 pm, Vineeth Mohan [vineethmo...@algotree.com](mailto:vineethmo...@algotree.com) wrote:
> > > 
> > > > A complete index is broken up into shards.
> > > > 
> > > > So if you have 10k documents in a index , and you assign 2 shards and 0  
> > > > replica , 5k documents will sit on one node , and the rest of 5k  
> > > > document  
> > > > will sit on the next node.
> > > > 
> > > > When a search request comes , the request is applied on both nodes  
> > > > and the  
> > > > result is merged to obtain the final result.  
> > > > Thus depending on the size of your index , you need to specify the  
> > > > number  
> > > > of shards.
> > > > 
> > > > If you increase the replica , a copy of data in each node is stored in  
> > > > some  
> > > > other node too. (This is to make sure even if one node goes down , you  
> > > > get  
> > > > to have the entire data)
> > > > 
> > > > Also one thing to remember here ,- you cant increase the number of  
> > > > shards  
> > > > after you set it for a index. But you can increase number of replica.
> > > > 
> > > > Thanks  
> > > > Vineeth
> > > > 
> > > > On Wed, Nov 2, 2011 at 1:59 PM, kalyan [kalyanc...@gmail.com](mailto:kalyanc...@gmail.com) wrote:
> > > > 
> > > > > Hi,  
> > > > > I am kind of new to this project.I have some doubts regarding  
> > > > > Shard,replica and index.
> > > > 
> > > > > As per as i know  
> > > > > 1.When we create 10k index with 2 shards and 1 replica on node 1  
> > > > > ,then  
> > > > > if I up node 2,node 2 must have 2 shards of 10k memory and node 1 as  
> > > > > well..  
> > > > > 2.On node 1, 2 shards will be created each shard having 5k memory.  
> > > > > Can u please clarify me whether above two scenarios are correct?
> > > > 
> > > > > What is the concept behind creating more than one shard on single  
> > > > > node or on multiple nodes?
> > > > 
> > > > > Its better if u tell any documents on basics of Elasticsearch.
> > > > 
> > > > > Thanks,  
> > > > > Kalyan.

---

<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 6, 2017, 3:50am UTC](https://discuss.elastic.co/t/shard/5745/7 "2017-07-06T03:50:08Z")

</div>


