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

Emit deprecation warning if multiple v1 templates match with a new index #55558

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ public ClusterState applyCreateIndexRequest(ClusterState currentState, CreateInd
final List<IndexTemplateMetadata> v1Templates = MetadataIndexTemplateService.findV1Templates(currentState.metadata(),
request.index(), isHiddenFromRequest);

if (v1Templates.size() > 1) {
deprecationLogger.deprecatedAndMaybeLog("index_template_multiple_match", "index [{}] matches multiple templates " +
"[{}], it won't be supported with index templates v2", request.index(),
probakowski marked this conversation as resolved.
Show resolved Hide resolved
v1Templates.stream().map(IndexTemplateMetadata::name).collect(Collectors.joining(", ")));
}

return applyCreateIndexRequestWithV1Templates(currentState, request, silent, v1Templates, metadataTransformer);
}
}
Expand Down