private Map<String, String> getNodesInfos(NodesInfoResponse nodesInfoResponse) {
Map<String, String> nodeInfoMap = new HashMap<>();
for (NodeInfo nodeInfo : nodesInfoResponse.getNodes()) {
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
builder.humanReadable(true).prettyPrint();
builder.startObject();
nodeInfo.getSettings().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getOs().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getProcess().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getJvm().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getThreadPool().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getTransport().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getPlugins().toXContent(builder, ToXContent.EMPTY_PARAMS);
nodeInfo.getIngest().toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
nodeInfoMap.put(nodeInfo.getNode().getName(), builder.string());
} catch (IOException e) {
Exceptions.handle(e);
}
}
return nodeInfoMap;
}