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

Adjust /_cat/templates not to request all metadata #78832

Conversation

DaveCTurner
Copy link
Contributor

Today GET /_cat/templates retrieves the whole cluster metadata from
the master, which includes all sorts of unnecessary junk and consumes
significant resources. This commit reimplements these endpoints using
GetIndexTemplatesAction and GetComposableIndexTemplateAction which
are much more efficient.

The docs for this API indicate that it accepts a comma-separated list of
template names/patterns of the form GET /_cat/templates/name1,name2
but in fact today it only accepts a single name or pattern. This commit
also adds support for multiple names/patterns as the docs claim.

Backport of #78829

Today `GET /_cat/templates` retrieves the whole cluster metadata from
the master, which includes all sorts of unnecessary junk and consumes
significant resources. This commit reimplements these endpoints using
`GetIndexTemplatesAction` and `GetComposableIndexTemplateAction` which
are much more efficient.

The docs for this API indicate that it accepts a comma-separated list of
template names/patterns of the form `GET /_cat/templates/name1,name2`
but in fact today it only accepts a single name or pattern. This commit
also adds support for multiple names/patterns as the docs claim.

Backport of elastic#78829
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Oct 7, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@DaveCTurner DaveCTurner added the test-full-bwc Trigger full BWC version matrix tests label Oct 7, 2021
@DaveCTurner
Copy link
Contributor Author

@elasticmachine test this please

@DaveCTurner DaveCTurner merged commit 9949b6b into elastic:7.x Oct 7, 2021
@DaveCTurner DaveCTurner deleted the 2021-10-07-cat-templates-without-cluster-state-redux-7x branch October 7, 2021 15:43
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Dec 23, 2021
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, elastic#78832
elasticsearchmachine pushed a commit that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: #78832
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
tvernum added a commit to tvernum/elasticsearch that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, elastic#78832
Backport of: elastic#82046
elasticsearchmachine pushed a commit that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: #78832
tvernum added a commit that referenced this pull request Jan 5, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata
(in fields "templates", "index_template" and "component_template").
This cluster state is readable (via GET /_cluster/state) for users who
have the monitor privilege at the cluster level. However, calling the
explicit read endpoints for these templates required the
manage_index_templates privilege.

This change grants access to the template specific retrieval APIs for
all users (or API Keys) with the cluster monitor privilge so that they
can make use of these fit-for-purpose APIs instead of parsing data
directly from cluster metadata

Relates: elastic/beats#29554, #78832
Backport of: #82046
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
All three template types (legacy templates, composable index templates
and component templates) are stored in cluster state metadata (in fields
"templates", "index_template" and "component_template"). This cluster
state is readable (via GET /_cluster/state) for users who have the
monitor privilege at the cluster level. However, calling the explicit
read endpoints for these templates required the manage_index_templates
privilege. This change grants access to the template specific retrieval
APIs for all users (or API Keys) with the cluster monitor privilege so
that they can make use of these fit-for-purpose APIs instead of parsing
data directly from cluster metadata Relates:
elastic/beats#29554 Relates: elastic#78832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport >bug :Data Management/CAT APIs Text APIs behind /_cat Team:Data Management Meta label for data/management team test-full-bwc Trigger full BWC version matrix tests v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants