Elastic search : Can query include kind of a subquery or subqueries using multiple indices?

  • I have index1 with geo-point data, index2 with polygons. Index2 has multiple polygon rows for given say id value. I would like to find all geo-points from index1 that are inside any of the polygons from index2 having say id=1. Is it possible to do that in a single query?
  • One way, I thought was - combine all polygon rows for each unique id value using multi-polgon(so that it becomes single row for each unique id) during data ingestion itself and then it is easy to do the intersection/within query using 2 indices. But there may be a better way of doing this.. If there is, can you please share that idea? Thanks.

Elasticsearch does not support joins, so that is not possible.

That is as far as I can tell still a join. You might be able to enrich at index time, but I can't see a way to do it in a single query.

1 Like
  • Thanks for the feedback.. By enriching the data during ingestion, I was able to do it using the idea I mentioned earlier in the ticket.
  • Ticket can be closed.

This is not a ticket system, this is a community technical support forum :slight_smile:

  • Yes. I forgot that. Thanks for reminding..

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.