# Reindex from 5 to 6 and add explicit type field

**URL:** <https://discuss.elastic.co/t/reindex-from-5-to-6-and-add-explicit-type-field/155912>\
**Category:** Elasticsearch\
**Created:** [November 8, 2018, 2:53pm UTC](https://discuss.elastic.co/t/reindex-from-5-to-6-and-add-explicit-type-field/155912 "2018-11-08T14:53:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juiip](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@juiip](https://discuss.elastic.co/u/juiip)\
**Post date:** [November 8, 2018, 2:53pm UTC](https://discuss.elastic.co/t/reindex-from-5-to-6-and-add-explicit-type-field/155912/1 "2018-11-08T14:53:36Z")

</div>

I have the below command to reindex an ES 5 index into an ES 6 index. I am going to take each type of document within an index and change its type to "\_type".

I have added an explicit "type" field within the new index template, and was wondering if its possible to put the old type value into the explicit type field within my new index?

Is it possible to do so by adding something into the below code?

```
POST _reindex
{
  "source": {
    "index": "v5_index-2018.11.07",
    "type": "server"
  },
  "dest": {
    "index": "v6_index-2018.11.07",
    "type": "_doc"
  }
}
```

---

<div class="post-metadata">

**Author:** ![geekpete](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/geekpete/32/20409_2.png) [@geekpete](https://discuss.elastic.co/u/geekpete)\
**Post date:** [November 27, 2018, 3:18am UTC](https://discuss.elastic.co/t/reindex-from-5-to-6-and-add-explicit-type-field/155912/2 "2018-11-27T03:18:16Z")

</div>

The best strategies to deal with the removal of types are explained in the docs here:  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.5/removal-of-types.html#removal-of-types](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/removal-of-types.html#removal-of-types)

The two general options are reindex to a separate index per pre-existing type or to migrate to using a custom type field to differentiate the type using that field.

I think the reindex example for the custom type method is probably most closely matching what you're looking for:  
[https://www.elastic.co/guide/en/elasticsearch/reference/6.5/removal-of-types.html#\_custom\_type\_field\_2](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/removal-of-types.html#_custom_type_field_2)

---

<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 25, 2018, 3:18am UTC](https://discuss.elastic.co/t/reindex-from-5-to-6-and-add-explicit-type-field/155912/3 "2018-12-25T03:18:22Z")

</div>

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