# Docs about sharding and scatter/gather

**URL:** <https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178>\
**Category:** Elasticsearch\
**Created:** [March 31, 2011, 9:51pm UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178 "2011-03-31T21:51:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [March 31, 2011, 9:51pm UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/1 "2011-03-31T21:51:04Z")

</div>

Hi,

I can't seem to find the documentation about how ES shards documents  
(and how one can control that), is this available anywhere?

Also, I'm looking for something that describes how ES avoids  
scattering search requests to _all_ nodes and how it knows how to  
limit it only to a limited set of nodes, but also can't find that in  
the docs.

Could you please point me to the relevant docs so I can RTFM?

Thanks,  
Otis

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [March 31, 2011, 10:17pm UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/2 "2011-03-31T22:17:04Z")

</div>

Maybe that could help a bit

[http://elasticsearch.karmi.cz/guide/reference/api/search/search-type.html](http://elasticsearch.karmi.cz/guide/reference/api/search/search-type.html)

if not ask via irc:freenode

On 31 Mrz., 23:51, Otis [otis.gospodne...@gmail.com](mailto:otis.gospodne...@gmail.com) wrote:

> Hi,
> 
> I can't seem to find the documentation about how ES shards documents  
> (and how one can control that), is this available anywhere?
> 
> Also, I'm looking for something that describes how ES avoids  
> scattering search requests to _all_ nodes and how it knows how to  
> limit it only to a limited set of nodes, but also can't find that in  
> the docs.
> 
> Could you please point me to the relevant docs so I can RTFM?
> 
> Thanks,  
> Otis

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 1, 2011, 1:25am UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/3 "2011-04-01T01:25:37Z")

</div>

When you search against an index, the search will be executed across all shards. If you want to have fine grained control, you can use routing. When indexing / deleting you can provide an addition routing value, and when searching, you can provide a routing value(s) as well.

When using a routing value when indexing / deleting, its value is used instead of the id to decide which shard it will end up on (hashed).

When using routing value(s) when searching, the shard(s) those routing value(s) will match on will be searched.

-shay.banon  
On Thursday, March 31, 2011 at 11:51 PM, Otis wrote:

> Hi,
> 
> I can't seem to find the documentation about how ES shards documents  
> (and how one can control that), is this available anywhere?
> 
> Also, I'm looking for something that describes how ES avoids  
> scattering search requests to _all_ nodes and how it knows how to  
> limit it only to a limited set of nodes, but also can't find that in  
> the docs.
> 
> Could you please point me to the relevant docs so I can RTFM?
> 
> Thanks,  
> Otis

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [April 1, 2011, 5:50am UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/4 "2011-04-01T05:50:40Z")

</div>

Hi,

Yeah, routing is what I was looking for. Is  
[http://elasticsearch.karmi.cz/guide/reference/mapping/routing-field.html](http://elasticsearch.karmi.cz/guide/reference/mapping/routing-field.html)  
the best/only doc for it or is there some other piece of documentation  
where I can get the details?

Thanks,  
Otis

On Mar 31, 9:25 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> When you search against an index, the search will be executed across all shards. If you want to have fine grained control, you can use routing. When indexing / deleting you can provide an addition routing value, and when searching, you can provide a routing value(s) as well.
> 
> When using a routing value when indexing / deleting, its value is used instead of the id to decide which shard it will end up on (hashed).
> 
> When using routing value(s) when searching, the shard(s) those routing value(s) will match on will be searched.
> 
> -shay.banon
> 
> On Thursday, March 31, 2011 at 11:51 PM, Otis wrote:
> 
> > Hi,
> 
> > I can't seem to find the documentation about how ES shards documents  
> > (and how one can control that), is this available anywhere?
> 
> > Also, I'm looking for something that describes how ES avoids  
> > scattering search requests to _all_ nodes and how it knows how to  
> > limit it only to a limited set of nodes, but also can't find that in  
> > the docs.
> 
> > Could you please point me to the relevant docs so I can RTFM?
> 
> > Thanks,  
> > Otis

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 1, 2011, 10:36am UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/5 "2011-04-01T10:36:42Z")

</div>

The routing field allows to specify you want to get the routing from a specific field in the document. But, a better approach is to provide the routing when indexing a doc explicitly.

Check the routing sections for each API, for example: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/index_.html), [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/).

On Friday, April 1, 2011 at 8:50 AM, Otis wrote:

> Hi,
> 
> Yeah, routing is what I was looking for. Is  
> [http://elasticsearch.karmi.cz/guide/reference/mapping/routing-field.html](http://elasticsearch.karmi.cz/guide/reference/mapping/routing-field.html)  
> the best/only doc for it or is there some other piece of documentation  
> where I can get the details?
> 
> Thanks,  
> Otis
> 
> On Mar 31, 9:25 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > When you search against an index, the search will be executed across all shards. If you want to have fine grained control, you can use routing. When indexing / deleting you can provide an addition routing value, and when searching, you can provide a routing value(s) as well.
> > 
> > When using a routing value when indexing / deleting, its value is used instead of the id to decide which shard it will end up on (hashed).
> > 
> > When using routing value(s) when searching, the shard(s) those routing value(s) will match on will be searched.
> > 
> > -shay.banon
> > 
> > On Thursday, March 31, 2011 at 11:51 PM, Otis wrote:
> > 
> > > Hi,
> > 
> > > I can't seem to find the documentation about how ES shards documents  
> > > (and how one can control that), is this available anywhere?
> > 
> > > Also, I'm looking for something that describes how ES avoids  
> > > scattering search requests to _all_ nodes and how it knows how to  
> > > limit it only to a limited set of nodes, but also can't find that in  
> > > the docs.
> > 
> > > Could you please point me to the relevant docs so I can RTFM?
> > 
> > > Thanks,  
> > > Otis

---

<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, 4:08am UTC](https://discuss.elastic.co/t/docs-about-sharding-and-scatter-gather/4178/6 "2017-07-06T04:08:58Z")

</div>


