diff --git a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs index a605ea0b..a1560c9f 100644 --- a/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs +++ b/src/Serilog.Sinks.Elasticsearch/Sinks/ElasticSearch/ElasticsearchSinkState.cs @@ -69,8 +69,8 @@ private ElasticsearchSinkState(ElasticsearchSinkOptions options) if (string.IsNullOrWhiteSpace(options.IndexFormat)) throw new ArgumentException("options.IndexFormat"); if (string.IsNullOrWhiteSpace(options.TemplateName)) throw new ArgumentException("options.TemplateName"); - // Strip type argument if ESv7 since multiple types are not supported anymore - if (options.AutoRegisterTemplateVersion == AutoRegisterTemplateVersion.ESv7) + // Since TypeName is deprecated we shouldn't set it, if has been deliberately set to null. + if (options.TypeName == null && options.AutoRegisterTemplateVersion == AutoRegisterTemplateVersion.ESv7) { options.TypeName = "_doc"; }