Move _type into url

This commit is contained in:
Jean Flach 2018-04-06 15:24:43 +02:00 committed by Michael Friedrich
parent 975ac47f8e
commit fd5d4c5974
1 changed files with 7 additions and 5 deletions

View File

@ -353,13 +353,10 @@ void ElasticsearchWriter::Enqueue(const String& type, const Dictionary::Ptr& fie
String eventType = m_EventPrefix + type; String eventType = m_EventPrefix + type;
fields->Set("type", eventType); fields->Set("type", eventType);
/* Every payload needs a line describing the index above. /* Every payload needs a line describing the index.
* We do it this way to avoid problems with a near full queue. * We do it this way to avoid problems with a near full queue.
*/ */
String indexBody = "{\"index\": {} }\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); String fieldsBody = JsonEncode(fields);
Log(LogDebug, "ElasticsearchWriter") Log(LogDebug, "ElasticsearchWriter")
@ -421,6 +418,11 @@ void ElasticsearchWriter::SendRequest(const String& body)
*/ */
path.emplace_back(GetIndex() + "-" + Utility::FormatDateTime("%Y.%m.%d", Utility::GetTime())); path.emplace_back(GetIndex() + "-" + Utility::FormatDateTime("%Y.%m.%d", Utility::GetTime()));
/* ES 6 removes multiple _type mappings: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html
* Best practice is to statically define 'doc'.
*/
path.emplace_back("_doc");
/* Use the bulk message format. */ /* Use the bulk message format. */
path.emplace_back("_bulk"); path.emplace_back("_bulk");