Search by GeoDistance(DESC) and another field "created_date"(DESC)

Hi, I'm doing a search that will return to me through the location of the closest point to the furthest point. And to that include the date of creation from the most current to the oldest

I am using the REST API

searchSourceBuilder.sort(new FieldSortBuilder("created_at").order(SortOrder.DESC));
searchSourceBuilder.sort(new GeoDistanceSortBuilder("location",geoPoint).sortMode(SortMode.MIN).order(SortOrder.DESC));

But doesnt work

Btw I test with this curl but i dont kwon its the same of the API REST

curl -X GET "http://localhost:5443/index/_doc/_search" -H 'Content-Type: application/json' -d'
{
    "sort" : [
        {
            "_geo_distance" : {
                "location" : [-99.20600069999999,19.6149315],
                "order": "asc",
                "mode": "min"
            }
        },
        {"created_at" : {"order" : "desc"}}
    ],
	"size": 150
}
'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.