@@ -38,7 +38,6 @@ public class KNNStatsTransportAction extends TransportNodesAction<
38
38
39
39
private final KNNStats knnStats ;
40
40
private final Client client ;
41
- private KNNNodeStatAggregation knnNodeStatAggregation ;
42
41
43
42
/**
44
43
* Constructor
@@ -71,7 +70,6 @@ public KNNStatsTransportAction(
71
70
);
72
71
this .knnStats = knnStats ;
73
72
this .client = client ;
74
- this .knnNodeStatAggregation = null ;
75
73
}
76
74
77
75
@ Override
@@ -98,7 +96,7 @@ protected void doExecute(Task task, KNNStatsRequest request, ActionListener<KNNS
98
96
// Add the stats makes sure that we dont recurse infinitely.
99
97
dependentStats .forEach (knnStatsRequest ::addStat );
100
98
client .execute (KNNStatsAction .INSTANCE , knnStatsRequest , ActionListener .wrap (knnStatsResponse -> {
101
- knnNodeStatAggregation = new KNNNodeStatAggregation (knnStatsResponse .getNodes ());
99
+ request . setAggregation ( new KNNNodeStatAggregation (knnStatsResponse .getNodes () ));
102
100
contextListener .onResponse (null );
103
101
}, contextListener ::onFailure ));
104
102
} else {
@@ -118,7 +116,7 @@ protected KNNStatsResponse newResponse(
118
116
119
117
for (String statName : knnStats .getClusterStats ().keySet ()) {
120
118
if (statsToBeRetrieved .contains (statName )) {
121
- clusterStats .put (statName , knnStats .getStats ().get (statName ).getValue (knnNodeStatAggregation ));
119
+ clusterStats .put (statName , knnStats .getStats ().get (statName ).getValue (request . getAggregation () ));
122
120
}
123
121
}
124
122
0 commit comments