I have a usecase where I have 2 types of locations (i.e. with geo_point
- Location 1: Has a lat/lon with say radius=90 miles (it will vary) and
- Location 2: Has a lat/lon with no radius and type=incoming
Now, when a query comes in with: lat/lon and radius=20, I expect this to
- Simple geo lookup: If the input lat/lon is within 20miles of location 2,
return location 2.
- If input lat/lon is within 90 miles of Location 1, return location 1 too
in the result. If you notice, I want input radius to be overwritten by the
saved radius for a specific type of location.
This is what I have come up with using script:
"script": "!doc['geopoint'].empty && doc['coverage_type'].value ==
'outgoing' ? doc['geopoint'].distanceInMiles(37,-121) <=
doc['radius'].value : doc['geopoint'].distanceInMiles(37,-121) <= 20"
Where "37,-121" is input lat/lon and 20 is the input radius.
What do you think?
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CADjjot-aRjyyuHCfvPa2BrSFG6%3DPhqAcG1AwoszQF3dazXBHxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.