Skip to content

Conversation

@martijnvg
Copy link
Member

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.

…stream templates.

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Data streams)

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Sep 17, 2020
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

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, I left one suggestion for the error message

ComposableIndexTemplate template = currentState.getMetadata().templatesV2().get(templateName);
if (request.dataStreamName() == null && template.getDataStreamTemplate() != null) {
throw new IllegalArgumentException("cannot create index with name [" + request.index() +
"], because it matches with template [" + templateName + "] that creates data streams only");
Copy link
Member

Choose a reason for hiding this comment

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

I think we should try to steer the user in the right direction, can we suggest they try the create data stream API in the error message?

@martijnvg martijnvg merged commit 3e54550 into elastic:master Sep 17, 2020
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Sep 17, 2020
…stream templates

Backport of elastic#62527 to 7.x branch.

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Sep 17, 2020
…stream templates

Backport of elastic#62527 to 7.9 branch.

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.
martijnvg added a commit that referenced this pull request Sep 17, 2020
…stream templates (#62574)

Backport of #62527 to 7.x branch.

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.
martijnvg added a commit that referenced this pull request Sep 18, 2020
…stream templates (#62575)

Backport of #62527 to 7.9 branch.

This commit adds validation that prohibits the creation of regular indices
in the namespace of templates with data streams enabled.

It shouldn't be possible to create ordinary indices when the name of the index
matches with a composable index template that enables data streams. Auto creation
has logic that creates data streams instead of regular indices. However validation
logic for the create index api was missing.

* adjust docs test to not index into stack template namespace. (test was disabled on 7.x and master branches)
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
martijnvg added a commit that referenced this pull request Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Data Management/Data streams Data streams and their lifecycles Team:Data Management Meta label for data/management team v7.9.2 v7.10.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants