Suppose I have documents with a Geo bounding box information on them (for example, [bottom, left], [top, right]).
Given another bounding box as input, I'd like to find all documents who's bounding box intersects with the given input.
Based on what I know about Geo Location in elastic, I conclude that bounding box filters will not suffice for my needs, because they operate on Geo points, so it is possible that the two bounding boxes will intersect each other, but none of the boxes Geo points will be bound by any of the boxes. Geohash_cell filter will not be enough for the same reason as well. Is this correct?
If it is, I'm left with two possible choices:
- GeoShape indexing and filtering
- Script filter that will use simple rectangle intersection logic of the form:
rect1.left <= rect2.right && rect2.left <= rect1.right && rect1.bottom <= rect2.top && rect2.bottom <= rect1.top
My question is which of these do you think will be preferable in terms of query latency and/or index storage?