# Simple way to reindex a field type?

**URL:** <https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212>\
**Category:** Elasticsearch\
**Created:** [July 31, 2017, 3:34pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212 "2017-07-31T15:34:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)\
**Post date:** [July 31, 2017, 3:34pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212/1 "2017-07-31T15:34:01Z")

</div>

Say I have a bunch of daily log indices, created with Logstash dynamic templates, where one field has inconsistent datatypes over a span of a couple of weeks.

Is there a way to:

1. Create new indices (i.e. logstash-yy.mm.dd-01) _without_ having dynamic templates apply mappings
2. Reindex old -\> new indices, keeping the mapping except changing the incorrect field type to the correct one?

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 31, 2017, 3:47pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212/2 "2017-07-31T15:47:08Z")

</div>

1 - create new index name with different from logstash-\* name (assuming you have something like that)

```
# curl --silent localhost:9200/_cat/templates | grep logstash
logstash logstash-* 0 50001
# 

```

2 - [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)

---

<div class="post-metadata">

**Author:** ![rozling](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rozling/32/16401_2.png) [@rozling](https://discuss.elastic.co/u/rozling)\
**Post date:** [July 31, 2017, 3:55pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212/3 "2017-07-31T15:55:36Z")

</div>

Thanks alexus; I was hoping to get a little more guidance in using the Reindex API - can I use that to zone in on the incorrectly mapped field and change it, or do I need to specify the correct field in a template / dynamic template?

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [July 31, 2017, 10:54pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212/4 "2017-07-31T22:54:42Z")

</div>

Create index and set [Mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or do it via templates, then [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.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:** [August 28, 2017, 10:54pm UTC](https://discuss.elastic.co/t/simple-way-to-reindex-a-field-type/95212/5 "2017-08-28T22:54:58Z")

</div>

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