diff --git a/src/main/java/com/elasticsearch/dash/exporters/ESExporter.java b/src/main/java/com/elasticsearch/dash/exporters/ESExporter.java index 639109ba38d..b7becdc3b8a 100644 --- a/src/main/java/com/elasticsearch/dash/exporters/ESExporter.java +++ b/src/main/java/com/elasticsearch/dash/exporters/ESExporter.java @@ -5,6 +5,7 @@ */ package com.elasticsearch.dash.exporters; import com.elasticsearch.dash.Exporter; +import com.google.common.collect.ImmutableMap; import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.action.admin.cluster.node.stats.NodeStats; @@ -25,7 +26,7 @@ import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; -import java.util.Date; +import java.util.*; public class ESExporter extends AbstractLifecycleComponent implements Exporter { @@ -37,6 +38,9 @@ public class ESExporter extends AbstractLifecycleComponent implement final ESLogger logger = ESLoggerFactory.getLogger(ESExporter.class.getName()); + final ToXContent.Params xContentParams; + + public ESExporter(Settings settings, ClusterName clusterName) { super(settings); @@ -57,6 +61,9 @@ public class ESExporter extends AbstractLifecycleComponent implement } + xContentParams = new ToXContent.MapParams(ImmutableMap.of("human_readable","false")); + + logger.info("ESExporter initialized. Target: {}:{} Index prefix set to {}", targetHost, targetPort, targetIndexPrefix ); // explode early on broken settings getTargetURL("test"); @@ -77,6 +84,7 @@ public class ESExporter extends AbstractLifecycleComponent implement return "ESExporter"; } + @Override public void exportNodeStats(NodeStats nodeStats) { URL url = getTargetURL("nodestats"); @@ -91,7 +99,7 @@ public class ESExporter extends AbstractLifecycleComponent implement XContentBuilder builder = XContentFactory.smileBuilder(os); builder.startObject(); - nodeStats.toXContent(builder, ToXContent.EMPTY_PARAMS); + nodeStats.toXContent(builder, xContentParams); builder.endObject(); builder.close();