# Separate indexes for each kubernetes namespace

**URL:** <https://discuss.elastic.co/t/separate-indexes-for-each-kubernetes-namespace/169131>\
**Category:** Logstash\
**Created:** [February 20, 2019, 4:10am UTC](https://discuss.elastic.co/t/separate-indexes-for-each-kubernetes-namespace/169131 "2019-02-20T04:10:09Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 20, 2019, 9:58pm UTC](https://discuss.elastic.co/t/separate-indexes-for-each-kubernetes-namespace/169131/3 "2019-02-20T21:58:51Z")

</div>

If the events have a field on them that contains the namespace name then you can use a reference to that in the index option for the elasticsearch output

```
index => "%{[fieldContainingNamespaceName]}"

```

If you have 50 namespaces then you are going to end up with a large number of shards, which can impact performance in elasticsearch. You may want to [reduce](https://discuss.elastic.co/t/how-do-you-change-the-default-number-of-shards/1508/3?u=badger) the number of shards per index.

---

_[View the full topic](https://discuss.elastic.co/t/separate-indexes-for-each-kubernetes-namespace/169131)._
