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 #78829

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.

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.
@DaveCTurner
Copy link
Contributor Author

This was #78812 which got reverted because of test failures that the PR builds missed. See #78812 for reviews.

@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 added a commit to DaveCTurner/elasticsearch that referenced this pull request Oct 7, 2021
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
@DaveCTurner DaveCTurner merged commit 5823ad6 into elastic:master Oct 7, 2021
@DaveCTurner DaveCTurner deleted the 2021-10-07-cat-templates-without-cluster-state-redux branch October 7, 2021 15:43
DaveCTurner added a commit that referenced this pull request Oct 7, 2021
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
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Oct 7, 2021
wjp719 added a commit to wjp719/elasticsearch that referenced this pull request Oct 9, 2021
* master:
  Fix DataTierTests package and add a validation test (elastic#78880)
  Fix split package org.elasticsearch.common.xcontent (elastic#78831)
  Store DataTier Preference directly on IndexMetadata (elastic#78668)
  [DOCS] Fixes typo in calendar API example (elastic#78867)
  Improve Node Shutdown Observability (elastic#78727)
  Convert encrypted snapshot license object to LicensedFeature (elastic#78731)
  Revert "Make nodePaths() singular (elastic#72514)" (elastic#78801)
  Fix incorrect generic type in PolicyStepsRegistry (elastic#78628)
  [DOCS] Fixes ML get calendars API (elastic#78808)
  Implement GET API for System Feature Upgrades (elastic#78642)
  [TEST] More MetadataStateFormat tests (elastic#78577)
  Add support for rest compatibility headers to the HLRC (elastic#78490)
  Un-ignoring tests after backporting fix (elastic#78830)
  Add node REPLACE shutdown implementation (elastic#76247)
  Wrap VersionPropertiesLoader in a BuildService to decouple build logic projects (elastic#78704)
  Adjust /_cat/templates not to request all metadata (elastic#78829)
  [DOCS] Fixes ML get scheduled events API (elastic#78809)
  Enable exit on out of memory error (elastic#71542)

# Conflicts:
#	server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Oct 12, 2021
We document that `GET /_index_template/...` accepts a comma-separated
list of template names but in fact today this API accepts only a single
name or pattern. Likewise `GET /_cat/templates/...` (at least it didn't
until elastic#78829 but that's not released yet). This commit fixes the docs to
indicate these APIs accept only a single template name and also adds
some extra validation to reject requests containing a `,` since such a
request cannot match any actual templates.

It also adjusts `GET /_cat/templates` to use the filtering built into
`TransportGetComposableIndexTemplateAction` rather than retrieving all
templates and then filtering them on the coordinating node.
DaveCTurner added a commit that referenced this pull request Oct 13, 2021
We document that `GET /_index_template/...` accepts a comma-separated
list of template names but in fact today this API accepts only a single
name or pattern. Likewise `GET /_cat/templates/...` (at least it didn't
until #78829 but that's not released yet). This commit fixes the docs to
indicate these APIs accept only a single template name and also adds
some extra validation to reject requests containing a `,` since such a
request cannot match any actual templates.

It also adjusts `GET /_cat/templates` to use the filtering built into
`TransportGetComposableIndexTemplateAction` rather than retrieving all
templates and then filtering them on the coordinating node.
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Oct 13, 2021
We document that `GET /_index_template/...` accepts a comma-separated
list of template names but in fact today this API accepts only a single
name or pattern. Likewise `GET /_cat/templates/...` (at least it didn't
until elastic#78829 but that's not released yet). This commit fixes the docs to
indicate these APIs accept only a single template name and also adds
some extra validation to reject requests containing a `,` since such a
request cannot match any actual templates.

It also adjusts `GET /_cat/templates` to use the filtering built into
`TransportGetComposableIndexTemplateAction` rather than retrieving all
templates and then filtering them on the coordinating node.

Backport of elastic#78989
elasticsearchmachine pushed a commit that referenced this pull request Oct 13, 2021
We document that `GET /_index_template/...` accepts a comma-separated
list of template names but in fact today this API accepts only a single
name or pattern. Likewise `GET /_cat/templates/...` (at least it didn't
until #78829 but that's not released yet). This commit fixes the docs to
indicate these APIs accept only a single template name and also adds
some extra validation to reject requests containing a `,` since such a
request cannot match any actual templates.

It also adjusts `GET /_cat/templates` to use the filtering built into
`TransportGetComposableIndexTemplateAction` rather than retrieving all
templates and then filtering them on the coordinating node.

Backport of #78989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/CAT APIs Text APIs behind /_cat Team:Data Management Meta label for data/management team v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants