added routing_format=full to default toXContent params

This commit is contained in:
Boaz Leskes 2013-09-30 20:13:58 +02:00
parent 608d295086
commit 41f03b6461

View file

@ -76,7 +76,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
timeout = (int) settings.getAsTime("timeout", new TimeValue(6000)).seconds();
xContentParams = new ToXContent.MapParams(
ImmutableMap.of("load_average_format", "hash"));
ImmutableMap.of("load_average_format", "hash", "routing_format", "full"));
logger.info("ESExporter initialized. Targets: {}, index prefix [{}], index time format [{}]", hosts, indexPrefix, indexTimeFormat);
@ -112,15 +112,15 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
;
}
logger.debug("Exporting {}", type);
logger.debug("exporting {}", type);
HttpURLConnection conn = openConnection("POST", "/_bulk", XContentType.SMILE.restContentType());
if (conn == null) {
logger.error("Could not connect to any configured elasticsearch instances: [{}]", hosts);
logger.error("could not connect to any configured elasticsearch instances: [{}]", hosts);
return;
}
try {
OutputStream os = conn.getOutputStream();
// TODO: find a way to disable builder's substream flushing.
// TODO: find a way to disable builder's substream flushing or something neat solution
for (ToXContent xContent : xContentArray) {
XContentBuilder builder = XContentFactory.smileBuilder(os);
builder.startObject().startObject("index")
@ -148,7 +148,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
} catch (IOException e) {
logger.error("Error connecting to target", e);
logger.error("error sending data", e);
return;
}
@ -196,7 +196,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
return conn;
} catch (IOException e) {
logger.error("error connecting to [{}]: {}", host, e);
logger.error("error connecting to [{}]", e, host);
}
}
@ -245,7 +245,7 @@ public class ESExporter extends AbstractLifecycleComponent<ESExporter> implement
}
checkedForIndexTemplate = true;
} catch (IOException e) {
logger.error("Error when checking/adding metrics template to elasticsearch", e);
logger.error("error when checking/adding template to elasticsearch", e);
return false;
}
return true;