# Multiple types or multiple indexes? Best practices

**URL:** <https://discuss.elastic.co/t/multiple-types-or-multiple-indexes-best-practices/135107>\
**Category:** Elasticsearch\
**Created:** [June 8, 2018, 8:03am UTC](https://discuss.elastic.co/t/multiple-types-or-multiple-indexes-best-practices/135107 "2018-06-08T08:03:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baj1984](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@baj1984](https://discuss.elastic.co/u/baj1984)\
**Post date:** [June 8, 2018, 8:03am UTC](https://discuss.elastic.co/t/multiple-types-or-multiple-indexes-best-practices/135107/1 "2018-06-08T08:03:15Z")

</div>

Hi,

I'm knew to ES and coming from SQL background, so looking for some advice on best practices.

My problem:  
I have multiple buildings that each contain multiple documents specific to only that building. The mapping is the same for all buildings.

Should I be creating a new index for each building (there could be hundreds) or should I be creating a new type for each? Or maybe it's better to just add a building\_id property to each document and filter them that way.

Any help is muchly appreciated!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [June 8, 2018, 8:06am UTC](https://discuss.elastic.co/t/multiple-types-or-multiple-indexes-best-practices/135107/2 "2018-06-08T08:06:45Z")

</div>

> [@baj1984](#):
>
> Or maybe it's better to just add a building\_id property to each document and filter them that way.

Given that mappings are the same, I would say this is the way to go. You do not want to create lots of small indices as this is very inefficient and the ability to use multiple types within an index has been deprecated.

---

<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, 2018, 8:06am UTC](https://discuss.elastic.co/t/multiple-types-or-multiple-indexes-best-practices/135107/3 "2018-07-06T08:06:53Z")

</div>

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