Elasticsearch does not support joins so what you are trying to do is not possible. You will therefore need to change how you index and structure your data. If you can provide some details about your data and the problem you are trying to solve the community might be able to help.
My way of doing it is a little twisted but comes from my experience in managing data files.
imagine you have 3 tables.
Table_A and Table_B and Table_C
then in each of the ID tables.
I concatenate the table name with its id for each table.
In your table A you will have an additional column that looks like this:
"Table_A 54687561615 Table_B 7445123214"
"Table_A 54687561615 Table_B 7445123215"
"Table_A 54687561615 Table_B 7445123216"
Table B: (here it is you need bidirectional query)
"Table_B 7445123214 Table_A 54687561615
"Table_B 7445123215 Table_A 54687561615
"Table_B 7445123215 Table_C 1615
"Table_B 7445123216 Table_A 54687561615
"Table_B 8575123244 Table_C 1615
this column is a character string which will have the name of the table SPACE its id SPACE name of the table 2 SPACE its id
if you search on an ID, as this field in Elasticsearch is (must) be a text, its search method is of type phrase. i.e. each space is not considered as an indexing character.
a search for "Table_C 1615" will return the rows from table B and C that match:
"Table_B 7445123215 Table_C 1615"
"Table_B 8575123244 Table_C 1615"
"Table_C 1615 Table_B 7445123215"
"Table_C 1615 Table_B 8575123244"
which corresponds to a somewhat crude innerjoin but you do have all the information of your 4 elements 2 in table B and 2 in table C.