@@ -42,7 +42,13 @@ func initPlugin(alias, config string) (*elasticsearch, error) {
4242 }
4343
4444 replicas := util .GetReplicas ()
45- settings := fmt .Sprintf (config , alias , util .HiddenIndexSettings (), replicas )
45+
46+ settings := fmt .Sprintf (config , alias , util .HiddenIndexSettings (), replicas , LogsMappings )
47+
48+ if util .GetVersion () == 6 {
49+ mappings := fmt .Sprintf (`{"_doc": %s}` , LogsMappings )
50+ settings = fmt .Sprintf (config , alias , util .HiddenIndexSettings (), replicas , mappings )
51+ }
4652 // Meta index doesn't exist, create one
4753 indexName := alias + `-000001`
4854 // this works for ES6 client as well
@@ -111,10 +117,19 @@ func (es *elasticsearch) rolloverIndexJob(alias string) {
111117 settingsString := fmt .Sprintf (`{%s "index.number_of_shards": 1, "index.number_of_replicas": %d}` , util .HiddenIndexSettings (), util .GetReplicas ())
112118 settings := make (map [string ]interface {})
113119 json .Unmarshal ([]byte (settingsString ), & settings )
120+
121+ mappingString := LogsMappings
122+ if util .GetVersion () == 6 {
123+ mappingString = fmt .Sprintf (`{"_doc": %s}` , LogsMappings )
124+ }
125+
126+ mappings := make (map [string ]interface {})
127+ json .Unmarshal ([]byte (mappingString ), & mappings )
114128 rolloverService , err := es7 .NewIndicesRolloverService (util .GetClient7 ()).
115129 Alias (alias ).
116130 Conditions (rolloverConditions ).
117131 Settings (settings ).
132+ Mappings (mappings ).
118133 Do (ctx )
119134 if err != nil {
120135 log .Printf (logTag , "error while creating a rollover service %s %v" , alias , err )
0 commit comments