From 975ac47f8e2cda610abd9f43ea6649d8a9d2fb11 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 8 Feb 2018 18:00:00 +0100 Subject: [PATCH] Fix Elastic 6 support fixes #5905 --- lib/perfdata/elasticsearchwriter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 87f299712..cf78264bb 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -357,7 +357,9 @@ void ElasticsearchWriter::Enqueue(const String& type, const Dictionary::Ptr& fie * We do it this way to avoid problems with a near full queue. */ - String indexBody = R"({ "index" : { "_type" : ")" + eventType + "\" } }\n"; + /* ES 6 removes multiple _type mappings: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html + * We still need to send an index header. Best practice is to statically define 'doc'. */ + String indexBody = "{ \"index\" : { \"_type\": \"doc\" } }\n"; String fieldsBody = JsonEncode(fields); Log(LogDebug, "ElasticsearchWriter")