Skip to content

Feature request: report the expected mapping type on every mapping_exception #31502

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
redlus opened this issue Jun 21, 2018 · 3 comments
Closed
Labels
help wanted adoptme :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@redlus
Copy link

redlus commented Jun 21, 2018

Hi,

As part of our product, we're indexing our customer's data on elasticsearch clusters. For this reason, we cannot control the mapping types of each source, and cannot prevent mapping_exceptions from occurring. For each mapping_exception we're modifying the original document to avoid dataloss.

Currently, this is a difficult task, as elasticsearch does not report which mapping type is expected upon an exception - but only the field name that caused the exception within the indexed document; e.g.

failed to parse [field.with.mapping.exception]

There is one exception to this rule, which is when dealing with objects; e.g., when indexing a concrete value into a field with mapping_type of object:

object mapping for [object.field] tried to parse field [object.field] as object, but found a concrete value

Or when indexing a nested object into a concrete value:

Could not dynamically add mapping for field [boolfield.test]. Existing mapping for [boolfield] must be of type object but found [boolean].

The two exceptions above make it much easier to actually handle the exception and prevent dataloss. I'd like to suggest adding the expected mapping type for all mapping exceptions.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@javanna javanna added :Search Foundations/Mapping Index mappings, including merging and defining field types discuss labels Jun 21, 2018
@tomcallahan tomcallahan added help wanted adoptme and removed discuss labels Jun 21, 2018
@lipsill
Copy link
Contributor

lipsill commented Jun 24, 2018

Hi! I would like to give this one a try.
@redlus would something like failed to parse field [field.with.mapping.exception], expected type [field.type] work for you?

@redlus
Copy link
Author

redlus commented Jun 24, 2018

Hey @lipsill, that would be great 👍🏼

cbuescher pushed a commit that referenced this issue Aug 9, 2018
Currently if a document cannot be indexed because it violates the defined 
mapping for the index, a MapperException is thrown. In some cases it is 
useful to expose the expected field type in the exception itself, 
so that the user can react based on the error message. This change adds 
the expected data type to the MapperException.

Closes #31502
cbuescher pushed a commit that referenced this issue Aug 9, 2018
Currently if a document cannot be indexed because it violates the defined 
mapping for the index, a MapperException is thrown. In some cases it is 
useful to expose the expected field type in the exception itself, 
so that the user can react based on the error message. This change adds 
the expected data type to the MapperException.

Closes #31502
@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
help wanted adoptme :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

5 participants