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

Ensure index templates are not applied to system indices #16418

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ public ClusterState applyCreateIndexRequest(

// The backing index may have a different name or prefix than the data stream name.
final String name = request.dataStreamName() != null ? request.dataStreamName() : request.index();
// Do not apply any templates to system indices
// Using applyCreateIndexRequestWithV1Templates with empty list instead of applyCreateIndexRequestWithV2Template with null
// template as applyCreateIndexRequestWithV2Template has assertions when template is null
if (systemIndices.isSystemIndex(name)) {
pyek-bot marked this conversation as resolved.
Show resolved Hide resolved
return applyCreateIndexRequestWithV1Templates(currentState, request, silent, Collections.emptyList(), metadataTransformer);
pyek-bot marked this conversation as resolved.
Show resolved Hide resolved
}

// Check to see if a v2 template matched
final String v2Template = MetadataIndexTemplateService.findV2Template(
currentState.metadata(),
Expand Down
Loading