You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
geoSort("location") points List(new GeoPoint(lat, lon)) unit KILOMETERS geoDistance sortMode order SortOrder.DESC
it throws:
Geo distance sorting needs at least one point.
java.lang.IllegalArgumentException: Geo distance sorting needs at least one point.
at org.elasticsearch.search.sort.GeoDistanceSortBuilder.<init>(GeoDistanceSortBuilder.java:130)
at org.elasticsearch.search.sort.SortBuilders.geoDistanceSort(SortBuilders.java:88)
at com.sksamuel.elastic4s.searches.sort.GeoDistanceSortDefinition.<init>(GeoDistanceSortDefinition.scala:13)
at com.sksamuel.elastic4s.searches.sort.SortDsl$GeoSortExpectsPoints.points(SortDsl.scala:27)
This is because internally this goes to :
def points(points: Iterable[GeoPoint]): GeoDistanceSortDefinition =
new GeoDistanceSortDefinition(field, Nil, points.toSeq)
which calls
val builder = SortBuilders.geoDistanceSort(field, geohashes: _*).points(points: _*)
inside GeoDistanceSortDefinition
This calls a constructor that always expects a geohash in GeoDistanceSortBuilder,
instead of using the other constructor that expects GeoPoints
public GeoDistanceSortBuilder(String fieldName, String ... geohashes) {
if (geohashes.length == 0) {
throw new IllegalArgumentException("Geo distance sorting needs at least one point.");
}
...
The text was updated successfully, but these errors were encountered:
When geoSort is used with GeoPoint parameters:
it throws:
This is because internally this goes to :
which calls
inside GeoDistanceSortDefinition
This calls a constructor that always expects a geohash in GeoDistanceSortBuilder,
instead of using the other constructor that expects GeoPoints
The text was updated successfully, but these errors were encountered: