-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Render Mappings more Compact in GET /_cluster/state #83846
base: main
Are you sure you want to change the base?
Render Mappings more Compact in GET /_cluster/state #83846
Conversation
This deduplicates index mappings in the `/_cluster_state` response. This significantly reduces the response size for large cluster states, making this debug API easier to read for humans (because understanding whether or not mappings are duplicated across indices might be valuable) and more importantly less ressource hungry as far as serialization goes.
Pinging @elastic/es-distributed (Team:Distributed) |
Hi @original-brownbear, I've created a changelog YAML for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally +1 from me but we still need to consider whether to treat this as a breaking change or not. We could alternatively not change the default but start sending 429s to clients that request an unreasonably large response. Marking this as Request changes
until these questions are resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preparing for our discussion today, I read through this and provided a couple of comments.
if (mmd == null) { | ||
builder.nullField(KEY_MAPPINGS); | ||
} else { | ||
builder.field(KEY_MAPPINGS, indexMetadata.mapping().getSha256()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to pick a new name for the SHA256. mappings_sha256
maybe or perhaps shared_mappings_id
. Then we can also allow dumping both, which could provide a transitional path for clients.
@@ -2124,6 +2126,15 @@ public static void toXContent(Metadata metadata, XContentBuilder builder, ToXCon | |||
builder.endObject(); | |||
|
|||
if (context == XContentContext.API) { | |||
if (params.paramAsBoolean(MAPPINGS_BY_HASH_PARAM, true)) { | |||
builder.startObject("mappings"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can call this shared_mappings
and then have a flag of the same name to the API as well as a cluster setting to disable dumping non-shared mappings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Henning and I discussed this again today. We're not confident enough that nobody would be affected by this change in the default behaviour, and we think with chunked-encoding we can protect Elasticsearch against harm at least, so we would prefer to make the desired behaviour opt-in today, deprecate the old default, and remove it in the next major version.
I'll raise a proposal to do this with the breaking changes committee.
Pinging @elastic/es-distributed-obsolete (Team:Distributed (Obsolete)) |
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
This deduplicates index mappings in the
/_cluster/state
response by grouping them by the sha256 hash of the mapping.This significantly reduces the response size for large cluster states,
making this debug API easier to read for humans (because understanding
whether or not mappings are duplicated across indices might be valuable)
and more importantly less ressource hungry as far as serialization goes.
Adds an undocumented parameter to get back to the old format if we actually have to in an unforeseen instance.
New rendering of an index:
and then mappings at the same level as "indices":
relates #77466