-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
NEST/Elasticsearch.Net version:
5.6.0
Elasticsearch version:
5.6.6
Description of the problem including expected versus actual behavior:
The NEST API for specifying an index template with a mapping template which has a generic property exposes a method .Index(FieldIndexOption) rather than .Index(bool), as is the case with other type descriptors. The options exposed in the enum FieldIndexOption only apply to the legacy string type and in 5.x, the value of "index" must be either true or false.
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/mapping-index.html
Consider the following example which creates such an invalid specification:
var response = _client.PutIndexTemplate(templateName, desc => desc
.Template("index_template*")
.Settings(settings => settings
.NumberOfShards(1)
.NumberOfReplicas(1)
.Mappings(mappings => mappings
.Map<object>("_default_", s => s
.AllField(all => all
.Enabled(false))
.DynamicTemplates(dynamicTemplates => dynamicTemplates
.DynamicTemplate("default_template", defaultTemplate => defaultTemplate
.Match("*")
.Mapping(mapping => mapping
.Generic(g => g
.Type("{dynamic_type}")
// this is not valid in ES5
.Index(FieldIndexOption.NotAnalyzed)
.DocValues(true)
)
)
)
)
.Properties(properties => properties
.Date(date => date.Name("timestamp"))
.Date(date => date.Name("expiry"))
)
)
)
);
Metadata
Metadata
Assignees
Labels
No labels