-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot sort on geo_point fields #63
Comments
Using debugging, what does the query look like that is executed but returns the Elastic error? |
Well, AFAIK GeoDistance is not something included in this package, so I wouldn't necessarily expect it to work immediately in all facets of Scout/Elastic/Explorer. But perhaps together we can make it work! |
Looks like it is impossible to catch, server crashes before being able to return anything. To query over a GeoPoint field one need to use specific sorting features (as the error yields). If I use sort on a regular field (that is
What the package does when using
Which if ran on ElasticSearch yields the same error as mentioned in the issue's description. My wild guess to solve the problem would be to wrap field of type GeoPoint in a different way, such as:
Thereby having an option to either pass the |
Note that: The function also need to be able the sorting feature, which in the I think there's potential for expending this package to include the so called |
Ok, I have looked at the sorting feature and the current implementation is quite naive considering everything that is possible with ES. It will take quite some work to write a new implementation and rework how sorting is now done, so I cannot promise any timeline when I would be finished (or start) with this. I think for the time being you can circumvent it by using the Finder directly instead of your model, i.e.: $query = Query::with(new BoolQuery());
$builder = new SearchCommand('my_index', $query);
$query->setSort([new MyCustomGeoSort(....)]);
$finder = new Finder($client, $builder);
$results = $finder->find(); (Have a look at the Finder's tests and Elastic Engine to get to know it more) |
@Jeroen-G if you are working on the sort feature, it would be nice to have the Nested Sort too. Reading to your last reply I ended up with this solution. In this way I can have my data with paginations too. Hope it helps.
|
It seems that the "orderBy" function does not support sorting on fields of type geo_point.
The bellow function call will return every index entries within a distance of
$location['distance']
of the given location coordinate.When trying to apply a
orderBy('locations')
, I get this error:I have tried a few things but none of my attempts seem to work. Is this even out of the box supported?
What the ElasticSearch query should look like:
Thanks!
The text was updated successfully, but these errors were encountered: