How to Store Distance value to SortValues or Entity
问题 How to Store Distance value to SortValues or Entity using SDE4.0 @Query, and SearchHit "sort": [ { "_geo_distance" : { "codenames.geoLocation" : [ { "lat" : 32.846027, "lon" : -96.84987 } ], "unit" : "mi", "order" : "asc", } } ] 回答1: You have to add a Sort parameter t your repository query, see the documentation for Spring Data Elasticsearch 4 where this is described. In your case you'd need: Sort sort = Sort.by( new GeoDistanceOrder("geoLocation", new GeoPoint(32.846027, -96.84987))