Queries across two distinct indices


Let's say I have two indices S (fields: ID, shoe size) and H (fields: ID, height)
where there's at least one field that runs across the two sides.

Is it possible to run a native elastic query across the two, such as:
Get the height of everyone whose shoe size = 10.5.

I know I can do this in say a Python wrapper but I'm looking for the simplest
possible solution.

Thank you!

I think you need two ES queries:

  1. Get IDs from H where height == 10.5
  2. Multi-get records from S using IDs from step 1.

Alternatively, create a new index SH that joins the two indices on ID, and then you can run one ES query on it.

Thank you, Loren!

I didn't know about mget but it could definitely be useful.
Unfortunately, merging the indices won't be an option in my real project though.
I have three types of indices and I wanna be able to play this game with any combination
and in any direction and they're of massive sizes ...

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