I'm trying to figure out whether Elasticsearch might be a reasonable choice for our needs. We have time-indexed location data for several vehicles and want to know at what points in time the vehicles leave certain regions (the regions data will be in their own index for example). Ideally we would like the result telling us which region the vehicle left at what time and which region it entered at what time.
As far as I can see one potential way would be to run a date histogram and a geo_centroid aggregation so I could use a moving function aggregation with a window of length 2 with a script querying my regions index to test which regions the two points fall into.
I imagine that running queries inside scripts might not be possible but would love to hear otherwise.
If this is not possible, would it be feasible to put the data of my regions (let's say 50 regions, each a polygon consisting of about 2000 points) all in the script?