I would like to fully switch to elasticsearch to filter the elements that are currently being processed by PostGreSQL with the PostGIS extension.
To do this, I must select each result at a given distance (many) polygons.
These polygons can be complex (hundreds of points).
I saw that a year ago , elasticsearch was not able to process such filters.
After a year, ES expanded significantly (including the main version), so is this filtering now supported? If not, are there any plans?
To explain, this is a simple utility:
Consider this polygon as an example description of the borders of Paris "Ile de la cité":
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
2.339546203568933,
48.857710541463412
],
[
2.345168113663295,
48.856750530470009
],
[
2.350618362380806,
48.855056348509926
],
[
2.352077484084764,
48.853785674412812
],
[
2.352592468215498,
48.851611335037532
],
[
2.348730087234629,
48.852543206332619
],
[
2.343194007828603,
48.855084585345963
],
[
2.339546203568933,
48.857710541463412
]
]
]
]
}
(, ):
{
"type": "Point",
"coordinates": [
2.359378457022193,
48.850358223189644
]
}
Django ORM ( SQL, , ):
>>> Location.objects.filter(point__within=(area.polygon))
[]
>>> Location.objects.filter(point__distance_lte=(area.polygon, D(m=500)))
[]
>>> Location.objects.filter(point__distance_lte=(area.polygon, D(m=550)))
[<Location: Ile saint louis>]
__distance PostGIS ST_distance_sphere.