# Reindex Elasticsearch using new mapping

**URL:** https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534
**Category:** Logstash
**Created:** [November 6, 2017, 1:33pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534 "2017-11-06T13:33:58Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sreejithps303](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreejithps303/32/23868_2.png) [@sreejithps303](https://discuss.elastic.co/u/sreejithps303)
#### Post date: [November 6, 2017, 1:33pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/1 "2017-11-06T13:33:58Z")

</div>

Hi ,

I have 2 new fields added to the index and i want to renidex the old indices to include these two fields. I have a mapping csv file where i have an existing field and corresponding value for two new fields. I want to use this csv and re index the old indices?  
can anyone help?

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 10, 2017, 3:28pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/2 "2017-11-10T15:28:09Z")

</div>

I'm not able to follow what you're trying to do.

> [@sreejithps303](#):
>
> I have a mapping csv file where i have an existing field and corresponding value for two new fields.

Mapping has meaning to Elasticsearch, so this is harder to parse.

> [@sreejithps303](#):
>
> I want to use this csv and re index the old indices?

This is confusing as well. A reindex operation doesn't necessarily need anything new to work. If I had to guess at what you're describing, it's that you want to use the elasticsearch input plugin to read your existing index, and then use the values from this csv to somehow convert fields in the _old_ data into two new fields for the target indices? Is this correct?

If so, you should read up on the [translate filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-translate.html#_description_132), which should allow you to use the csv to accomplish this.

---

<div class="post-metadata">

### Author: ![sreejithps303](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreejithps303/32/23868_2.png) [@sreejithps303](https://discuss.elastic.co/u/sreejithps303)
#### Post date: [November 11, 2017, 6:14pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/3 "2017-11-11T18:14:40Z")

</div>

> [@theuntergeek](#):
>
> describing

whatever the you guessed was correct and thanks for suggesting logstash translate plugin. I was using ruby filter plugin and written a small code snippet to parse the csv . Translate plugin will do same without any effort.

I have one more question , Can we add two fields from csv or yaml file in a single translate filter block? when i checked i could see the `destination` is a string and always allows single field.  
So i think in my case i need to write two filer blocks?

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [November 11, 2017, 6:46pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/4 "2017-11-11T18:46:12Z")

</div>

Yes, sorry. Translate only allows one match right now.

---

<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: [November 11, 2017, 8:54pm UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/5 "2017-11-11T20:54:04Z")

</div>

The match could however be a JSON string that you then can decode using a JSON filter.

---

<div class="post-metadata">

### Author: ![sreejithps303](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreejithps303/32/23868_2.png) [@sreejithps303](https://discuss.elastic.co/u/sreejithps303)
#### Post date: [November 12, 2017, 4:43am UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/6 "2017-11-12T04:43:54Z")

</div>

I have got another option. Storing the multiple fields from translate filter to csv and then use the csv filter to parse it.  
below link has the details.

> [@Translate return multiple fields](https://discuss.elastic.co/t/translate-return-multiple-fields/64590/10):
>
> In that case use the csv filter on the field containing "field1,field2,field3".

---

<div class="post-metadata">

### Author: ![sreejithps303](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sreejithps303/32/23868_2.png) [@sreejithps303](https://discuss.elastic.co/u/sreejithps303)
#### Post date: [November 12, 2017, 4:46am UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/7 "2017-11-12T04:46:27Z")

</div>

thanks , same i did it with csv filter .

---

<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: [December 10, 2017, 4:46am UTC](https://discuss.elastic.co/t/reindex-elasticsearch-using-new-mapping/106534/8 "2017-12-10T04:46:42Z")

</div>

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