Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ public enum Flag {
Translog("translog", 13),
// 14 was previously used for Suggest
RequestCache("request_cache", 15),
Recovery("recovery", 16);
Recovery("recovery", 16),
StatusCounter("status_counter", 17);

private final String restName;
private final int index;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,18 @@ public NodeIndicesStats stats(CommonStatsFlags flags) {
break;
}
}
// Only include status_counter when it is explicitly requested (or when all flags are set).
// Previously it was always included regardless of the requested index metrics, causing it
// to appear even for targeted requests like GET _nodes/stats/indices/request_cache.
// See https://github.com/opensearch-project/OpenSearch/issues/22383
final StatusCounterStats resolvedStatusCounterStats = flags.isSet(CommonStatsFlags.Flag.StatusCounter)
? statusCounterStats
: null;
if (flags.getIncludeIndicesStatsByLevel()) {
NodeIndicesStats.StatsLevel statsLevel = NodeIndicesStats.getAcceptedLevel(flags.getLevels());
return new NodeIndicesStats(commonStats, statsByShard(this, flags), searchRequestStats, statusCounterStats, statsLevel);
return new NodeIndicesStats(commonStats, statsByShard(this, flags), searchRequestStats, resolvedStatusCounterStats, statsLevel);
} else {
return new NodeIndicesStats(commonStats, statsByShard(this, flags), searchRequestStats, statusCounterStats);
return new NodeIndicesStats(commonStats, statsByShard(this, flags), searchRequestStats, resolvedStatusCounterStats);
}
}

Expand Down
Loading