# Generate child indices out of an index

**URL:** <https://discuss.elastic.co/t/generate-child-indices-out-of-an-index/199152>\
**Category:** Elasticsearch\
**Created:** [September 11, 2019, 10:32pm UTC](https://discuss.elastic.co/t/generate-child-indices-out-of-an-index/199152 "2019-09-11T22:32:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![murali12180](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/murali12180/32/47810_2.png) [@murali12180](https://discuss.elastic.co/u/murali12180)\
**Post date:** [September 11, 2019, 10:32pm UTC](https://discuss.elastic.co/t/generate-child-indices-out-of-an-index/199152/1 "2019-09-11T22:32:27Z")

</div>

Hi,

I have an index "idx-2019-09" which carries "city" field. I'd like to break this index into separate indices by city.

Before:  
idx-2019-09  
{  
"city" : "boston",  
},  
{  
"city": "new york",  
}

After:  
idx-boston-2019-09  
{  
"city": "boston"  
}

idx-newyork-2019-09  
{  
"city": "newyork"  
}

thanks in advance.

---

<div class="post-metadata">

**Author:** ![VietCong](https://avatars.discourse-cdn.com/v4/letter/v/e47774/32.png) [@VietCong](https://discuss.elastic.co/u/VietCong)\
**Post date:** [September 12, 2019, 2:41am UTC](https://discuss.elastic.co/t/generate-child-indices-out-of-an-index/199152/2 "2019-09-12T02:41:09Z")

</div>

Logstash filter might be what you are looking for. There are multiple way but if your data set is small enough, you can look at the elasticsearch input plugin to get the data from the current index then use the logstash filter and output to output data to different indices based city field.

[https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html)

---

<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:** [October 10, 2019, 2:41am UTC](https://discuss.elastic.co/t/generate-child-indices-out-of-an-index/199152/3 "2019-10-10T02:41:16Z")

</div>

Closed on October 10, 2019, 2:41am UTC

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