I am a tad confused when it comes to indexing my domain models that include plain Latitude / Longitude (both double properties) with Nest / ElasticSearch.Net:
Is there a way to map those two POCO / double properties over & tell ElasticSearch.Net that these two are actually what they are, geolocation points and have them indexed accordingly without having to pull in a dependency of ElasticSearch.net and its GeoLocation type in the domain model assembly?
I'd rather not do the later nor would I want to create separate 'search'-specific models.
The geo_point
type consists of both a latitude and longitude coordinate and supports a few different input formats : object (with lat lon properties), array, or a comma-delimited string.
You can't map two separate double fields as a single geo_point
field. You'll have to add another field to your POCO and combine them using one of the supported formats.
The object format however is ideal since there is no discrepancy on which value is lat and which is lon. If you want to keep your POCO clean of NEST dependencies, you can always roll your own geo type as long as it contains a Lat
and Lon
property, instead of using the baked in GeoLocation
type.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.