Skip to content

Reindexing from index with doc type to non-typed mapping fails #43100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hackery opened this issue Jun 11, 2019 · 5 comments
Closed

Reindexing from index with doc type to non-typed mapping fails #43100

hackery opened this issue Jun 11, 2019 · 5 comments
Assignees
Labels
:Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@hackery
Copy link

hackery commented Jun 11, 2019

Elasticsearch version 6.8.0:
Plugins installed: None
JVM version Oracle 1.8.0_201
OS version Linux example 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

We're working through the process to migrate to 7.x and remove any document types. All indices we have, have (always had) only one type (e.g. "events" or "transactions"). Trying a reindex from a "typed" index to an "untyped" one (specified with the same template with the type level removed and ?include_type_name=false) gives a mapping conflict:

POST /_reindex
{
  "source": {
    "index": "example-2019-06-09"
  },
  "dest": {
    "index": "example-2019-06-09-test"
  }
}

# task API output ...
"cause": {
        "type": "illegal_argument_exception",
        "reason": "Rejecting mapping update to [example-2019-06-09-test] as the final mapping would have more than 1 type: [_doc, events]"

It seems this should be disregarding the type of the source and honouring the un-typed template for creating the new index.

@dadoonet described a solution on the forum, but this situation and the "type" option should be described in the documentation.

Adding "type": "_doc" (not doc as given) worked for my reindexing.

@alpar-t alpar-t added the :Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down label Jun 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@alpar-t alpar-t added the :Search Foundations/Mapping Index mappings, including merging and defining field types label Jun 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@henningandersen
Copy link
Contributor

@hackery thanks for your interest in elasticsearch. I noticed that you are running version 6.8 but linking to "current" documentation. When I look in documentation for 6.8:

https://www.elastic.co/guide/en/elasticsearch/reference/6.8/docs-reindex.html

the type option seems to be described adequately. Please let us know if there is additional clarification necessary?

@jtibshirani
Copy link
Contributor

jtibshirani commented Aug 1, 2019

The 6.8 reindex documentation also looks correct to me. The 'typeless' reindex + index APIs were only added in 7.0 and are not yet available in 6.x. So when the type is omitted for the destination index, reindex still uses the old behavior where the type is taken from documents in the _source index. In 7.0, omitting the type is interpreted as a 'typeless' call, so there is no type conflict error.

I noticed in the removal of types documentation that we forget to specify the destination type when reindexing. This is probably causing confusion, I opened #45118 to address it.

The behavior on 6.x is quite subtle, but I hope that the correction to the documentation will make it clearer for users what to do. We also have a blog post which goes through the 7.0 upgrade steps in detail: https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0

jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
jtibshirani added a commit that referenced this issue Aug 6, 2019
Previously, the reindex examples did not include `_doc` as the destination type.
This would result in the reindex failing with the error "Rejecting mapping
update to [users] as the final mapping would have more than 1 type: [_doc,
user]".

Relates to #43100.
@jtibshirani
Copy link
Contributor

I'm going to close out this issue, thanks for raising it as it led to an important clarification in the docs.

@javanna javanna added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Reindex Issues relating to reindex that are not caused by issues further down :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

6 participants