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

sanitize index templates before removal #72780

Closed
gbanasiak opened this issue Feb 26, 2021 · 7 comments
Closed

sanitize index templates before removal #72780

gbanasiak opened this issue Feb 26, 2021 · 7 comments
Labels
:Data Management/Indices APIs APIs to create and manage indices and templates Team:Data Management Meta label for data/management team team-discuss

Comments

@gbanasiak
Copy link
Contributor

Kibana version: 7.11.1

Describe the bug:

Removal of an index template with * results in removal of all matching index templates. Note: prior to ES 7.8.0, index templates with * were accepted (see PR #56170, issue #43737).

Steps to reproduce:

  1. Create < 7.8.0 ES cluster and configure test-* and test-1 legacy index templates (PUT _template/<template-name>).
  2. Upgrade ES/Kibana to 7.11.1
  3. Delete test-* index template in Kibana -> Stack Management -> Index Management -> Index Templates
  4. Observe that both test-1 and test-* index templates were removed (due to test-* in DELETE _template/test-* being interpreted as an index template name wildcard).

Expected behavior:
Only the index template selected for removal is in fact removed.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@cjcenizal
Copy link
Contributor

This sounds like it pertains to the ES API, not the UI. I'll move this over to the ES repo.

@cjcenizal cjcenizal transferred this issue from elastic/kibana May 5, 2021
@cjcenizal cjcenizal added :Data Management/Indices APIs APIs to create and manage indices and templates needs:triage Requires assignment of a team area label labels May 5, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label May 5, 2021
@elasticmachine
Copy link
Collaborator

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

@gbanasiak
Copy link
Contributor Author

I've raised this in Kibana because ES API does what it is supposed to do - it honours the wildcard. There's a slight difference in perception when you delete a specific index template in the UI (you select only one specific item on the list), vs. when running the ES API call with * at the end. The latter has a higher chance of being correctly interpreted by the user as "this will remove all matching index templates".

Random thoughts on how this could be addressed:

  • ES API - extra option to confirm wildcard expansion (a breaking change)
  • Kibana - extra warning / confirmation in case of index template wildcard removal

@jakelandis jakelandis added team-discuss and removed needs:triage Requires assignment of a team area label labels May 6, 2021
@jakelandis
Copy link
Contributor

We likely won't introduce any breaking changes for the legacy index templates. However, for composable templates (and component template) this is relevant.

I added team discuss to discuss if, on delete and a* matches multiple templates, should we require an additional parameter such as allow_multi_delete=true ?

somewhat related to: #65667

@cjcenizal
Copy link
Contributor

@gbanasiak Thanks for your explanation! Now I understand. Yes, this is certainly a confusing UX. Thanks for your thoughts on possible solutions, too.

@danhermann
Copy link
Contributor

This is an unfortunate consequence of the fact that we inadvertently permitted characters such as * in legacy index template names in versions of ES prior to 7.8. Since the problem can be worked around and is not known to be widespread, we'd prefer not to add an option such as allow_multiple_delete and instead spend that development effort on ensuring that we don't have other objects that permit inappropriate characters such as * in their names.

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 team-discuss
Projects
None yet
Development

No branches or pull requests

5 participants