# Need Help To Decide Num Of Shard & Replicas

**URL:** <https://discuss.elastic.co/t/need-help-to-decide-num-of-shard-replicas/16830>\
**Category:** Elasticsearch\
**Created:** [April 5, 2014, 6:17pm UTC](https://discuss.elastic.co/t/need-help-to-decide-num-of-shard-replicas/16830 "2014-04-05T18:17:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkidkid](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zkidkid](https://discuss.elastic.co/u/zkidkid)\
**Post date:** [April 5, 2014, 6:17pm UTC](https://discuss.elastic.co/t/need-help-to-decide-num-of-shard-replicas/16830/1 "2014-04-05T18:17:48Z")

</div>

Hi All,  
I am working on a location search system.

At first time I set up:  
2 server (24 core, 64Gb Ram).  
5 Primary shard & 1 replicas.  
I do some term filter & numeric range filter & geo distance filter & sort  
by geo distance.  
Term filter will be put on one bool filter.  
AndFilter will hold bool filter then other numeric range filter & geo  
distance filter  
But it look so slow.

I optimize it by change:

1. 2 primary shard & 1 replicas. (my node = 2, so it's ok with 2 (node) =  
2(primary shard) + (1(replicas) +1))
2. Wrap range filter into bool filter & enable cache.
3. Wrap AndFilter to hold bool filter & geo distance filter
4. Decrease merge factor to 2, increase refresh interval to 2s (default is  
1s), set cache size to 4gb.  
The result is really fine until now.

My data is tiny, from 1M-2M. And I would expect to handle upto 5M.

I would need some advice to optimize it better, should I change to use only  
1 primary shard ? Should I increase replicas ? Should I do routing ?

I appreciate your help ^^

Best Regards.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e7212be8-47f3-46a6-b7c1-c43fd7859a3d%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e7212be8-47f3-46a6-b7c1-c43fd7859a3d%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:37am UTC](https://discuss.elastic.co/t/need-help-to-decide-num-of-shard-replicas/16830/2 "2017-07-06T01:37:59Z")

</div>

Closed on July 6, 2017, 1:37am UTC


