# Problems changing type in reindex

**URL:** <https://discuss.elastic.co/t/problems-changing-type-in-reindex/253511>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [October 28, 2020, 2:57am UTC](https://discuss.elastic.co/t/problems-changing-type-in-reindex/253511 "2020-10-28T02:57:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [October 28, 2020, 2:57am UTC](https://discuss.elastic.co/t/problems-changing-type-in-reindex/253511/1 "2020-10-28T02:57:51Z")

</div>

I am ES 6.8 -- trying to get stuff tidy to migrate to 7.x

Using ruby api to do the reindex :

`client.reindex source: { index:index_name, type: 'auth' }, target: { index: new_index_name, type: 'doc' },refresh: true`

The aim is to reduce the number of shards per index to that given in the new index template. The new index template also has a different type (\_doc).

The new index gets with the correct number of shards but is empty. All writes to the new index fail with  
` as the final mapping would have more than 1 type: [_doc, auth]`

I have tried various combinations of setting type in source and target but I always get the same result.

The source type is 'auth' and the target one is '\_doc'

---

<div class="post-metadata">

**Author:** ![Russell\_Fulton](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russell_fulton/32/62888_2.png) [@Russell\_Fulton](https://discuss.elastic.co/u/Russell_Fulton)\
**Post date:** [November 2, 2020, 12:56am UTC](https://discuss.elastic.co/t/problems-changing-type-in-reindex/253511/2 "2020-11-02T00:56:17Z")

</div>

After a of of trial and error I found that

`client.reindex source: { index:index_name, type: 'auth' }, target: { index: new_index_name, type: 'auth' }`

ran without errors

---

<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:** [November 30, 2020, 12:56am UTC](https://discuss.elastic.co/t/problems-changing-type-in-reindex/253511/3 "2020-11-30T00:56:19Z")

</div>

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