# Elastic search, multiple indexes vs one index

**URL:** <https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080>\
**Category:** Elasticsearch\
**Created:** [July 22, 2015, 1:41pm UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080 "2015-07-22T13:41:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya\_Patel](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Aditya\_Patel](https://discuss.elastic.co/u/Aditya_Patel)\
**Post date:** [July 22, 2015, 1:41pm UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/1 "2015-07-22T13:41:20Z")

</div>

Hi Everybody,  
I am trying to use Elasticsearch to store objects which all have similar fields and some field values are same in various objects. I have location specific data with me.

For ex. For a lot of objects a location field (city) would be same. In the end every object would be associated with location and neighbourhood and other localised features. I want to understand how to create indices properly wrt speed of search query and also respecting data storage issues.  
According to me and i might be completely off track.

Strategy-1:

-Create a single index in which all objects would be stored and when we want to query we can filter the index based on various fields.

Strategy-2:

- Create indices based on locations and have objects inside them. This would speed up my query but would increase indices , I am not sure how the memory usage gets affected by this one.

Just to give it more perspective , the locations data i have currently is around 50-60 but might increase to 500 or more.

Currently i am getting more inclined towards the second strategy as it would speed up my search queries as well when i want to get aggregation stats but not sure how it would scale up efficiently.

Thanks

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 23, 2015, 7:20am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/2 "2015-07-23T07:20:37Z")

</div>

Are you having performance issues now?

Also, why not look at routing with option 1?

---

<div class="post-metadata">

**Author:** ![Aditya\_Patel](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Aditya\_Patel](https://discuss.elastic.co/u/Aditya_Patel)\
**Post date:** [July 23, 2015, 8:04am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/3 "2015-07-23T08:04:26Z")

</div>

Thanks for the reply.

Quite frankly. I have just started with Elasticsearch , initially i have a postgres but for faster searches and statistics based on fields. I am moving to Elasticsearch.  
So currently i am trying to develop a mapping such that its  
1.) Get statistics like top 5 locations with lowest rent fast (I still don't know how to use aggregation for this though 🙂  
2.) Use data visualisation effectively for ex. plotting a line chart only for a particular location.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 23, 2015, 8:11am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/4 "2015-07-23T08:11:25Z")

</div>

Put your data into ES and then use Kibana to build a visualisation of what you think you want.  
Then you can view the query and see how the actual agg is built and copy that 🙂

---

<div class="post-metadata">

**Author:** ![Aditya\_Patel](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Aditya\_Patel](https://discuss.elastic.co/u/Aditya_Patel)\
**Post date:** [July 23, 2015, 8:59am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/5 "2015-07-23T08:59:53Z")

</div>

Thanks !  
But how do you get queries from Visualization for ex. data table (we can use this to get top 5) but how do you find the elasticsearch specific query for it.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 23, 2015, 9:25am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/6 "2015-07-23T09:25:16Z")

</div>

There's a little `^` arrow at the bottom of each visualisation, click that and there is a `Request` button, click that.

---

<div class="post-metadata">

**Author:** ![Aditya\_Patel](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@Aditya\_Patel](https://discuss.elastic.co/u/Aditya_Patel)\
**Post date:** [July 23, 2015, 11:17am UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/7 "2015-07-23T11:17:15Z")

</div>

Thanks alot ! I was able to get the query. 😊  
For now i am thinking of going ahead with multiple indexing , it will aid in visualisation location wise. Do you see any significant downside in this approach.

---

<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 5, 2017, 11:59pm UTC](https://discuss.elastic.co/t/elastic-search-multiple-indexes-vs-one-index/26080/8 "2017-07-05T23:59:31Z")

</div>


