Hi,
I am trying to make a query on elasticsearch that reproduce the same result of this SQL:
select pl.latitude, pl.longitude from places as pl
where exists (
select rf.id from references as rf where ST_Distance_Sphere(
point(pl.longitude, pl.latitude),
point(rf.longitude, rf.latitude)
) < 1000
)
In other words, based on two indices, to find out which place is less than 1000 meters from any reference in set registered.
My indices are:
GET /places
{
"places" : {
"aliases" : { },
"mappings" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
GET /references
{
"references" : {
"aliases" : { },
"mappings" : {
"properties" : {
"location" : {
"type" : "geo_point"
}
}
}
}
Is it possible in ES?