pokaleshrey
(Shreyash Pokale)
December 11, 2017, 11:12am
1
My query is:
{
"query": {
//Some query here
},
"sort": [{
"_geo_distance": {
"location": {
"lat": 49.8693846,
"lon": -99.9405093
},
"order": "asc",
"unit": "m"
}
}]
}
I need the code/hints which will let me form this sort at "query" level, programatically in Java.
Please quote any classes that i can use.
dadoonet
(David Pilato)
December 11, 2017, 2:27pm
2
On another project, I wrote something like:
SearchRequest request = new SearchRequest(banoIndexName)
.source(new SearchSourceBuilder()
.sort(new GeoDistanceSortBuilder("location", lat, lon).sortMode(SortMode.AVG))
);
HTH
1 Like
system
(system)
Closed
January 9, 2018, 6:33am
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.