# How to choose size parameter when using partitioning

**URL:** <https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031>\
**Category:** Elasticsearch\
**Created:** [April 2, 2019, 4:05pm UTC](https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031 "2019-04-02T16:05:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anindya\_Roy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anindya_roy/32/43317_2.png) [@Anindya\_Roy](https://discuss.elastic.co/u/Anindya_Roy)\
**Post date:** [April 2, 2019, 4:05pm UTC](https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031/1 "2019-04-02T16:05:30Z")

</div>

Hello,  
How should I choose the size parameter when using partitioning query ?

E.g  
Suppose the aggregation query result returns 60K hits and say I use num\_partitions = 20, then is it correct to expect the total result is spread across 20 partitions, so I can specify the size as 3000 (60k/20) when making 20 queries with partition id 0 through 19 ?

e.g. [showing the first aggregation block only]

"aggs": {  
"ip": {  
"terms": {  
"field": "ip",  
"include": {  
"partition": 0,  
"num\_partitions": 20  
},  
"size": 3000  
},

Similarly - if I use num\_partitions = 200, then should I use size = 300 and run 200 queries to retreive the 60k response ?

Thanks a lot for your insight.  
best regards  
Anindya

---

<div class="post-metadata">

**Author:** ![Anindya\_Roy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anindya_roy/32/43317_2.png) [@Anindya\_Roy](https://discuss.elastic.co/u/Anindya_Roy)\
**Post date:** [April 2, 2019, 7:09pm UTC](https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031/2 "2019-04-02T19:09:02Z")

</div>

A related but different question:  
I am using the current default 5 shards) for the index.  
What is the recommended best practice in terms of choosing the number of partitions in relations with number of shards in the index ?  
More partitions will translate to more query (i.e. more IOPs) with smaller results.  
vs running smaller number of larger individual queries by using less number of partitions.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 2, 2019, 8:36pm UTC](https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031/3 "2019-04-02T20:36:37Z")

</div>

May I suggest you look at the following resources about sizing:

[https://www.elastic.co/elasticon/conf/2016/sf/quantitative-cluster-sizing](https://www.elastic.co/elasticon/conf/2016/sf/quantitative-cluster-sizing)

> **[How many shards should I have in my Elasticsearch cluster?
	  	 | Elastic](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster)**
>
> Elasticsearch is a very versatile platform, that supports a variety of use cases, and provides great flexibility around data organisation and replication strategies. This flexibility can however somet...

https://www.slideshare.net/slideshow/embed_code/key/vR0XKDq4TGa77z

And [https://www.elastic.co/webinars/using-rally-to-get-your-elasticsearch-cluster-size-right](https://www.elastic.co/webinars/using-rally-to-get-your-elasticsearch-cluster-size-right)

---

<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:** [April 30, 2019, 8:36pm UTC](https://discuss.elastic.co/t/how-to-choose-size-parameter-when-using-partitioning/175031/4 "2019-04-30T20:36:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
