# Term filter vs multiple indices

**URL:** <https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299>\
**Category:** Elasticsearch\
**Created:** [March 20, 2017, 5:51pm UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299 "2017-03-20T17:51:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eldad\_Moneta](https://avatars.discourse-cdn.com/v4/letter/e/e95f7d/32.png) [@Eldad\_Moneta](https://discuss.elastic.co/u/Eldad_Moneta)\
**Post date:** [March 20, 2017, 5:51pm UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299/1 "2017-03-20T17:51:52Z")

</div>

Hi,

I have millions of metrics for ~1 hundred sources (the number of sources will raise in the future).  
A query is always for a single source.  
I'm already splitting the indices per day.

I'm trying to decide between multiple indices - one per source vs a single index with the source as a term in the document (in this case, all queries will use a term filter with the source id).

Is there a performance difference between the 2 above? during index? during query?

The cluster is write heavy- thousands of index requests (that translate to tens of bulk requests) per second.

Thanks.

---

<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:** [March 20, 2017, 6:06pm UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299/2 "2017-03-20T18:06:42Z")

</div>

If whatever the source all docs have same fields, I'd try with one single index.

If not, I'd try to avoid sparse fields and would split into separate indices.

---

<div class="post-metadata">

**Author:** ![Eldad\_Moneta](https://avatars.discourse-cdn.com/v4/letter/e/e95f7d/32.png) [@Eldad\_Moneta](https://discuss.elastic.co/u/Eldad_Moneta)\
**Post date:** [March 21, 2017, 7:56am UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299/3 "2017-03-21T07:56:23Z")

</div>

Thank you @dadoonet.  
All docs are of the same type and have the same fields so I guess the answer is single index.  
Does this answer based on better maintainability, or there are performance considerations as well?

---

<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:** [March 21, 2017, 8:17am UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299/4 "2017-03-21T08:17:55Z")

</div>

Sharing the same Lucene instances will consume less resources. That's why I'd probably mix that.

---

<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 18, 2017, 8:18am UTC](https://discuss.elastic.co/t/term-filter-vs-multiple-indices/79299/5 "2017-04-18T08:18:07Z")

</div>

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