Reputation:
I'm working with the Azure Search API in Postman. I have a query where I can return fields within a specified radius and it returns them in order from the nearest.
Is there a way to have a field that displays the actual distance. Eg if a place is 5.5km away that returns as a field.
This is my POST request
https://.search.windows.net/indexes/general-practitioner-practice//docs/search?api-version=2020-06-30&search=&filter=geo.distance(geo_location, geography'POINT(1111, 1111)') le 4,&select=*&count=true
This is my body
{
"search": "",
"filter": "geo.distance(Location, geography'POINT(1111, 1111)') le 4",
"select": "*",
"count": "true"
}
Upvotes: 1
Views: 222
Reputation: 8634
Azure Cognitive Search does not currently support returning the distance in the query result. The workaround is to calculate it on the client side. Details on how to do this can be found here and here.
If you'd like to see support for this added to Azure Cognitive Search, please vote on this UserVoice item to help us prioritize.
Upvotes: 1