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

Do not allow breaking v2 index templates by removing in-use component templates #56314

Closed
jasontedor opened this issue May 7, 2020 · 4 comments · Fixed by #56397
Closed

Do not allow breaking v2 index templates by removing in-use component templates #56314

jasontedor opened this issue May 7, 2020 · 4 comments · Fixed by #56397
Assignees
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team

Comments

@jasontedor
Copy link
Member

A major design goal of v2 index templates is to allow us to perform more thorough validation at template creation time. Such templates are composed of explicit component templates, so we can validate the resulting template. However, removing a component template that is used by a v2 index template would break any v2 index templates using that component template, thus ruining our plan for more thorough validation of v2 index templates. We should prevent the breakage by not allowing removing component templates that are in use by any v2 index template.

@jasontedor jasontedor added the :Data Management/Indices APIs APIs to create and manage indices and templates label May 7, 2020
@elasticmachine
Copy link
Collaborator

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

@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label May 7, 2020
@cjcenizal
Copy link
Contributor

Should we also disallow creating/updating an index template with a component template that doesn't exist? This currently returns a 200:

PUT _index_template/test
{
  "index_patterns": ["test"],
  "composed_of": ["does_not_exist"]
}

Even though this index template isn't "broken", I think it's logical for this request to fail the same way the originally described request would fail, since they both end up in the same state: an index template referring to a nonexistent component template.

@dakrone
Copy link
Member

dakrone commented May 7, 2020

Should we also disallow creating/updating an index template with a component template that doesn't exist?

I think we should, at least to avoid the case where someone typos a component template name and has an unintended consequence.

@jasontedor
Copy link
Member Author

Even though this index template isn't "broken"

I think it is broken.

I think we should, at least to avoid the case where someone typos a component template name and has an unintended consequence.

I agree, the goal is that v2 index templates should be unbreakable.

dakrone added a commit to dakrone/elasticsearch that referenced this issue May 7, 2020
This commit removes the ability to put V2 index templates that refence missing component templates.
It also prevents removing component templates that are being referenced by an existing V2 index
template.

Relates to elastic#53101
Resolves elastic#56314
dakrone added a commit that referenced this issue May 14, 2020
This commit removes the ability to put V2 index templates that reference missing component templates.
It also prevents removing component templates that are being referenced by an existing V2 index
template.

Relates to #53101
Resolves #56314
dakrone added a commit to dakrone/elasticsearch that referenced this issue May 14, 2020
This commit removes the ability to put V2 index templates that reference missing component templates.
It also prevents removing component templates that are being referenced by an existing V2 index
template.

Relates to elastic#53101
Resolves elastic#56314
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 Team:Data Management Meta label for data/management team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants