Skip to content
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

Improve error message in case of invalid dynamic templates #60870

Conversation

martijnvg
Copy link
Member

Include the attempted 'match_mapping_type' into the message,
so that it is clearer that multiple validation attempts have occurred.

Dynamic template validation was recently added via #51233 and
there was some confusion over the deprecation message itself.
(in 7.x only deprecation warning will be omitted and from 8.0
an error will be returned)

Include the attempted 'match_mapping_type' into the message,
so that it is clearer that multiple validation attempts have occurred.

Dynamic template validation was recently added via elastic#51233 and
there was some confusion over the deprecation message itself.
(in 7.x only deprecation warning will be omitted and from 8.0
 an error will be returned)
@martijnvg martijnvg added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types :Data Management/Indices APIs APIs to create and manage indices and templates v8.0.0 v7.10.0 labels Aug 10, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

@elasticmachine elasticmachine added Team:Search Meta label for search team Team:Data Management Meta label for data/management team labels Aug 10, 2020
@danhermann danhermann self-requested a review September 3, 2020 14:00
Copy link
Contributor

@danhermann danhermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Two minor comments for your consideration.

docs/reference/mapping/dynamic/templates.asciidoc Outdated Show resolved Hide resolved
String message = String.format(Locale.ROOT, "dynamic template [%s] has invalid content [%s]",
dynamicTemplate.getName(), Strings.toString(dynamicTemplate));
String format = "dynamic template [%s] has invalid content [%s], " +
"attempted to validate it with the following [match_mapping_type]: [%s]";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't error messages usually use square brackets around values rather than names? In other words, should there be square brackets around match_mapping_type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I don't think so.

@andreidan andreidan added v7.11.0 and removed v7.10.0 labels Oct 7, 2020
@martijnvg
Copy link
Member Author

@elasticmachine update branch

@martijnvg
Copy link
Member Author

@elasticmachine run elasticsearch-ci/docs

@martijnvg martijnvg merged commit 6f9f3e5 into elastic:master Nov 12, 2020
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Nov 12, 2020
Backporting elastic#60870 to 7.x branch.

Include the attempted 'match_mapping_type' into the message,
so that it is clearer that multiple validation attempts have occurred.

Dynamic template validation was recently added via elastic#51233 and
there was some confusion over the deprecation message itself.
(in 7.x only deprecation warning will be omitted and from 8.0
 an error will be returned)
martijnvg added a commit that referenced this pull request Nov 12, 2020
Backporting #60870 to 7.x branch.

Include the attempted 'match_mapping_type' into the message,
so that it is clearer that multiple validation attempts have occurred.

Dynamic template validation was recently added via #51233 and
there was some confusion over the deprecation message itself.
(in 7.x only deprecation warning will be omitted and from 8.0
 an error will be returned)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Data Management Meta label for data/management team Team:Search Meta label for search team v7.11.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants