I have a document with a field
posted_from of the type
location. I want to search all the documents posted from 25km radius. This is what I am using:
You can see that to be able to retrieve all the documents, I am using an empty query. Is this the best way of doing it?
I've read we can't sort by location fields and the search results don't contain the
posted_from so that I could do the sorting on my end. Any suggestions on how I could sort the result set by proximity?
Using an empty query is the best way to get all documents matching your filters.
As for getting location fields returned in results, we will be releasing an update soon that sends these back in results by default. For now, you are able to use the
fetch_fields parameter and passing in the name of your location field(s). You can read more about that behavior here.