Joining More than 2 Indices

Hi,

Is there any way to do join more than 2 indices?

Cheers,
Michael

Hi,

You can use the Elasticsearch’s syntax for writing index patterns. Also, the indices field that you join to is an array.

GET /siren/indexa,indexb/_search
{
   "query": {
      "join": {
         "indices": [
            "index1",
            "index2",
            "index_pattern"
         ],
         "on": [
            "fk",
            "id"
         ],
         "request": {
            "query": {
               "match_all": {}
            }
         }
      }
   }
}

The join query being part of the Elasticsearch’s query DSL, you can include as you wish it in other Elasticsearch queries such as bool. You can also nest joins within the request field.