use of com.o19s.es.ltr.action.LTRStatsAction.LTRStatsNodeResponse in project elasticsearch-learning-to-rank by o19s.
the class TransportLTRStatsActionTests method testNewResponse.
public void testNewResponse() {
String[] nodeIds = null;
LTRStatsNodesRequest ltrStatsRequest = new LTRStatsNodesRequest(nodeIds);
ltrStatsRequest.setStatsToBeRetrieved(ltrStats.getStats().keySet());
List<LTRStatsNodeResponse> responses = new ArrayList<>();
List<FailedNodeException> failures = new ArrayList<>();
LTRStatsNodesResponse ltrStatsResponse = action.newResponse(ltrStatsRequest, responses, failures);
assertEquals(1, ltrStatsResponse.getClusterStats().size());
}
use of com.o19s.es.ltr.action.LTRStatsAction.LTRStatsNodeResponse in project elasticsearch-learning-to-rank by o19s.
the class TransportLTRStatsActionTests method testNodeOperation.
public void testNodeOperation() {
String[] nodeIds = null;
LTRStatsNodesRequest ltrStatsRequest = new LTRStatsNodesRequest(nodeIds);
ltrStatsRequest.setStatsToBeRetrieved(ltrStats.getStats().keySet());
LTRStatsNodeResponse response = action.nodeOperation(new LTRStatsNodeRequest(ltrStatsRequest));
Map<String, Object> stats = response.getStatsMap();
assertEquals(1, stats.size());
}
use of com.o19s.es.ltr.action.LTRStatsAction.LTRStatsNodeResponse in project elasticsearch-learning-to-rank by o19s.
the class TransportLTRStatsAction method nodeOperation.
@Override
protected LTRStatsNodeResponse nodeOperation(LTRStatsNodeRequest request) {
LTRStatsNodesRequest nodesRequest = request.getLTRStatsNodesRequest();
Set<String> statsToBeRetrieved = nodesRequest.getStatsToBeRetrieved();
Map<String, Object> statValues = ltrStats.getNodeStats().entrySet().stream().filter(e -> statsToBeRetrieved.contains(e.getKey())).collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().getStatValue()));
return new LTRStatsNodeResponse(clusterService.localNode(), statValues);
}
Aggregations