Skip to content

Only allow retrieving a single index or component template#54694

Merged
dakrone merged 4 commits intoelastic:masterfrom
dakrone:itv2-only-get-single-item
Apr 7, 2020
Merged

Only allow retrieving a single index or component template#54694
dakrone merged 4 commits intoelastic:masterfrom
dakrone:itv2-only-get-single-item

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone dakrone commented Apr 2, 2020

This changes the Index Template v2 APIs to only allow retrieving a single "named" entity, where the
named entity can be nothing (return everything), a wildcard (return the ones that match), or the
name of a template.

Relates to #53101

This changes the Index Template v2 APIs to only allow retrieving a single "named" entity, where the
named entity can be nothing (return everything), a wildcard (return the ones that match), or the
name of a template.

Relates to elastic#53101
@dakrone dakrone added :Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. v8.0.0 v7.8.0 labels Apr 2, 2020
@dakrone dakrone requested review from martijnvg and probakowski April 2, 2020 23:17
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

Looks good, left a question regarding if querying for a specific template and that template doesn't exist.

results.put(name, allTemplates.get(name));
}
} else if (allTemplates.containsKey(name)) {
results.put(name, allTemplates.get(name));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think in case when the template is missing here (when asking for a specific template by name) we want to throw a resource not found exception. Like was done here: https://github.com/elastic/elasticsearch/pull/54530/files#diff-e753c14c84c5edb785bc197306e5a24fR180

results.put(name, allTemplates.get(name));
}
} else if (allTemplates.containsKey(name)) {
results.put(name, allTemplates.get(name));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Throw a resource not found exception if template does not exist?

Copy link
Copy Markdown
Contributor

@probakowski probakowski left a comment

Choose a reason for hiding this comment

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

Looks good, I agree with @martijnvg though, that we should throw exception when template is not found

@martijnvg martijnvg mentioned this pull request Apr 3, 2020
39 tasks
@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Apr 3, 2020

@elasticmachine update branch

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Apr 3, 2020

@elasticmachine run elasticsearch-ci/2

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Apr 3, 2020

(Opened #54759 for the unrelated PR CI failure)

@elasticmachine run elasticsearch-ci/2

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Apr 7, 2020

@elasticmachine update branch

@dakrone dakrone merged commit 6ae2d5e into elastic:master Apr 7, 2020
@dakrone dakrone deleted the itv2-only-get-single-item branch April 7, 2020 14:04
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Apr 7, 2020
…4694)

* Only allow retrieving a single index or component template

This changes the Index Template v2 APIs to only allow retrieving a single "named" entity, where the
named entity can be nothing (return everything), a wildcard (return the ones that match), or the
name of a template.

Relates to elastic#53101

* Throw exception when resource is not found

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/Indices APIs DO NOT USE. Use ":Distributed/Indices APIs" or ":StorageEngine/Templates" instead. >non-issue v7.8.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants