Generate child indices out of an index

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.

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