Skip to content

Conversation

@ketkee-aryamane
Copy link
Contributor

Linked to #360
adds enums for Metrics and IndexMetrics for node stats endpoint

Added the enum values by referring the 8.19 docs

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Following you can find the validation changes against the target branch for the API.

API Status Request Response
nodes.stats 🔴 58/58 → 51/58 21/58

You can validate this API yourself by using the make validate target.

@flobernd
Copy link
Member

flobernd commented Nov 8, 2025

Wondering if this case is similar to @pquentin recent related PR in a way that the server accepts combinations of multiple of these enum values (flags).

We should define an alias:
SomeMetricFlags = SomeMetricEnum | SomeMetricEnum[]

if that's the case.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Sorry, as discussed offline last week, I did not know that you were working on fixing those APIs. I did it for another reason, namely #5215.

That said, on the docs side, we also need descriptions of the enum values. This documented enum:

/**
* Type of index that wildcard expressions can match.
*/
export enum ExpandWildcard {
/** Match any data stream or index, including hidden ones. */
all,
/** Match open, non-hidden indices. Also matches any non-hidden data stream. */
open,
/** Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. */
closed,
/** Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`. */
hidden,
/** Wildcard expressions are not accepted. */
none
}

renders like this:

438247900-93fd5b13-c997-46e9-a814-acc46824e66a

Comment on lines +257 to +273
export enum Metrics {
adaptive_selection,
allocations,
breaker,
discovery,
fs,
http,
indexing_pressure,
indices,
ingest,
jvm,
os,
process,
repositories,
thread_pool,
transport
}
Copy link
Member

Choose a reason for hiding this comment

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

This enum is not used. But I already defined it as NodeStatsMetric in specification/nodes/stats/NodesStatsRequest.ts anyway, with a few values that were missing in the 8.x docs so far.

Comment on lines -73 to +74
index_metric?: CommonStatsFlags
index_metric?: IndexMetrics
Copy link
Member

Choose a reason for hiding this comment

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

CommonStatsFlag is the name of the enum in the server code, so that was already correct. (Your version is also missing _all that is accepted by the server too.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants