Closed
Description
Elastic.Clients.Elasticsearch version:
8.9.1
Elasticsearch version:
8.9.0
.NET runtime version:
7.0.9
Operating system version:
Windows 11
Description of the problem including expected versus actual behavior:
Describing a completion property with some contexts with the fluent api descriptor like this
.Properties(f => f
.Completion(completionField, cp => cp
.Analyzer(Es.Analyzer.ViaSuggest)
.Contexts(
c => c
.Type(Es.Completion.Context.Type)
.Name(Es.Completion.Context.Fqn)
)
)
generate this concrete mapping which is missing the contexts
"suggests": {
"analyzer": "viaSuggestAnalyzer",
"max_input_length": 50,
"preserve_position_increments": true,
"preserve_separators": true,
"type": "completion"
}
But if I describe the contexts in C# like this with a List:
.Properties(f => f
.Completion(completionField, cp => cp
.Analyzer(Es.Analyzer.ViaSuggest)
.Contexts( new List<SuggestContext> { new() { Name = Es.Completion.Context.Fqn, Type = Es.Completion.Context.Type } } )
)
then the correct JSON is generated:
"suggests": {
"analyzer": "viaSuggestAnalyzer",
"contexts": [{
"name": "fqn",
"type": "CATEGORY"
}
],
"max_input_length": 50,
"preserve_position_increments": true,
"preserve_separators": true,
"type": "completion"
}