]> granicus.if.org Git - icinga2/commitdiff
Fix Elastic 6 support
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 8 Feb 2018 17:00:00 +0000 (18:00 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 17 Apr 2018 07:17:20 +0000 (09:17 +0200)
fixes #5905

lib/perfdata/elasticsearchwriter.cpp

index 87f2997122875ce1c13e0353a4f0e36e7a66c988..cf78264bb4f41f812269420041b0ba1e33993578 100644 (file)
@@ -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")