-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
NEST/Elasticsearch.Net version: 6
Elasticsearch version: 6
Description of the problem including expected versus actual behavior:
When applying Mapping within client.CreateIndex, the GeoLocation Completion-descriptor takes a collection of Precision-values. However, ES only accepts a singular value. Even passing one-value to .Precision("25mi") results in the construction of an array. This eventually leads to an ES syntax-error when creating the index.
Steps to reproduce:
public class PlaceSearchDocument
{
[GeoPoint]
public Location Location { get; set; }
}
client.CreateIndex("places", (CreateIndexDescriptor createDescriptor) =>
createDescriptor.Mappings(mappingDescriptor =>
mappingDescriptor.Map<PlaceSearchDocument>(map => map
.AllField(af => af.Enabled(false))
.AutoMap()
.Properties(property => property
.Completion(completion => completion.Name("LocationSuggest").Contexts(context => context
.GeoLocation(geolocation => geolocation
.Name("Location")
.Path("Location")
.Precision("25mi"))
))))));Provide DebugInformation (if relevant):
PUT places
{
"mappings": {
"place": {
"_all": {
"enabled": false
},
"properties": {
"Location": {
"type": "geo_point"
},
"LocationSuggest": {
"type": "completion",
"contexts": [
{
"type": "geo",
"name": "Location",
"path": "Location",
"precision": ["25mi"]
}
]
}
}
}
}
}Expected value
PUT places
{
"mappings": {
"place": {
"_all": {
"enabled": false
},
"properties": {
"Location": {
"type": "geo_point"
},
"LocationSuggest": {
"type": "completion",
"contexts": [
{
"type": "geo",
"name": "Location",
"path": "Location",
"precision": "25mi"
}
]
}
}
}
}
}Ref.
elasticsearch-net/src/Nest/Search/Suggesters/ContextSuggester/GeoSuggestContext.cs
Line 35 in c646b98
| public GeoSuggestContextDescriptor<T> Precision(params string[] precisions) => Assign(precisions, (a, v) => a.Precision = v); |
khalidabuhakmeh
Metadata
Metadata
Assignees
Labels
No labels