diff --git a/libbeat/outputs/elasticsearch/client.go b/libbeat/outputs/elasticsearch/client.go index 84f216e4c98..b69ed9112db 100644 --- a/libbeat/outputs/elasticsearch/client.go +++ b/libbeat/outputs/elasticsearch/client.go @@ -132,9 +132,7 @@ var ( ) const ( - defaultEventTypeES6 = "doc" - defaultEventTypeES7 = "_doc" - defaultEventType = defaultEventTypeES7 + defaultEventType = "_doc" ) // NewClient instantiates a new client. @@ -691,12 +689,7 @@ func (client *Client) Connect() error { return err } - if client.GetVersion().Major < 7 { - client.eventType = defaultEventTypeES6 - } else { - client.eventType = defaultEventType - } - + client.eventType = defaultEventType return nil } diff --git a/libbeat/outputs/elasticsearch/client_test.go b/libbeat/outputs/elasticsearch/client_test.go index 83f8834bf72..dc2bb77513d 100644 --- a/libbeat/outputs/elasticsearch/client_test.go +++ b/libbeat/outputs/elasticsearch/client_test.go @@ -395,12 +395,7 @@ func TestBulkEncodeEvents(t *testing.T) { config common.MapStr events []common.MapStr }{ - "ES 6.x event": { - docType: "doc", - config: common.MapStr{}, - events: []common.MapStr{{"message": "test"}}, - }, - "ES 7.x event": { + "Beats 7.x event": { docType: "_doc", config: common.MapStr{}, events: []common.MapStr{{"message": "test"}}, diff --git a/libbeat/template/load_integration_test.go b/libbeat/template/load_integration_test.go index ac4910362d5..84cae1c48ec 100644 --- a/libbeat/template/load_integration_test.go +++ b/libbeat/template/load_integration_test.go @@ -356,7 +356,7 @@ func TestTemplateWithData(t *testing.T) { assert.True(t, loader.CheckTemplate(tmpl.GetName())) for _, test := range dataTests { - _, _, err = client.Index(tmpl.GetName(), "doc", "", nil, test.data) + _, _, err = client.Index(tmpl.GetName(), "_doc", "", nil, test.data) if test.error { assert.NotNil(t, err) @@ -395,13 +395,7 @@ func getTemplate(t *testing.T, client ESClient, templateName string) testTemplat } func (tt *testTemplate) SourceEnabled() bool { - docType := "_doc" - major := tt.client.GetVersion().Major - if major < 7 { - docType = "doc" - } - - key := fmt.Sprintf("mappings.%v._source.enabled", docType) + key := fmt.Sprintf("mappings._doc._source.enabled") // _source.enabled is true if it's missing (default) b, _ := tt.HasKey(key) diff --git a/libbeat/template/template.go b/libbeat/template/template.go index 540077b29d6..5273b3f4851 100644 --- a/libbeat/template/template.go +++ b/libbeat/template/template.go @@ -205,15 +205,12 @@ func (t *Template) Generate(properties common.MapStr, dynamicTemplates []common. indexSettings.Put("number_of_routing_shards", defaultNumberOfRoutingShards) } - var mappingName string + mappingName := "_doc" major := t.esVersion.Major switch { case major < 6: mappingName = "_default_" - case major == 6: - mappingName = "doc" case major >= 7: - mappingName = "_doc" defaultFields = append(defaultFields, "fields.*") indexSettings.Put("query.default_field", defaultFields) }