Skip to content

Commit 505f2b4

Browse files
committed
do not override already set params
1 parent cfb498c commit 505f2b4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ protected void writeNodesTo(StreamOutput out, List<NodeStats> nodes) throws IOEx
4444

4545
@Override
4646
protected Iterator<? extends ToXContent> xContentChunks(ToXContent.Params outerParams) {
47+
if (outerParams.param(DenseVectorStats.INCLUDE_OFF_HEAP) == null) {
48+
outerParams = new ToXContent.DelegatingMapParams(Map.of(DenseVectorStats.INCLUDE_OFF_HEAP, "true"), outerParams);
49+
}
4750
var finalOuterParams = new ToXContent.DelegatingMapParams(Map.of(DenseVectorStats.INCLUDE_OFF_HEAP, "true"), outerParams);
4851
return ChunkedToXContentHelper.object(
4952
"nodes",

server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ public void writeTo(StreamOutput out) throws IOException {
186186
}
187187

188188
@Override
189-
protected Iterator<ToXContent> customXContentChunks(ToXContent.Params outterParams) {
190-
var params = new ToXContent.DelegatingMapParams(Map.of(DenseVectorStats.INCLUDE_OFF_HEAP, "true"), outterParams);
189+
protected Iterator<ToXContent> customXContentChunks(ToXContent.Params outerParams) {
190+
if (outerParams.param(DenseVectorStats.INCLUDE_OFF_HEAP) == null) {
191+
outerParams = new ToXContent.DelegatingMapParams(Map.of(DenseVectorStats.INCLUDE_OFF_HEAP, "true"), outerParams);
192+
}
193+
var params = outerParams;
191194
final ClusterStatsLevel level = ClusterStatsLevel.of(params, ClusterStatsLevel.INDICES);
192195
if (level == ClusterStatsLevel.INDICES || level == ClusterStatsLevel.SHARDS) {
193196
return Iterators.concat(

0 commit comments

Comments
 (0)