Example
In this example, we will join all the documents from index1
with the documents of index2
using the HASH_JOIN
algorithm. The query first filters documents from index2
and of type type
with the query { "terms" : { "tag" : [ "aaa" ] } }
. It then retrieves the ids of the documents from the field id
specified by the parameter on
. The list of ids is then used as filter and applied on the field foreign_key
of the documents from index1
.
GET /siren/index1/_search { "query" : { "join" : { "type": "HASH_JOIN", "indices" : ["index2"], "types" : ["type"], "on" : ["foreign_key", "id"], "request" : { "query" : { "terms" : { "tag" : [ "aaa" ] } } } } } }