Is it possiible to join many indices

is it possible to join more then 2 indicies?
for example
index 1 - movies - has fields: [country_id, actors_ids]
index 2 - actors - has field: [id]
index 3 - countries - has field: [id]

so, I want do like this:
join ‘movies’ with 2 indicies ‘actors’ and ‘countries’ with: movies.country_id = country.id, movies.actors_ids = actors.id

is it going to be possible in the future?

You can use join queries together with the other ES queries. Therefore you can achieve what you want with a bool query:

GET /siren/movies/_search
{
   "query": {
      "bool": {
         "must": [
            {
               "join": {
                  "indices": [
                     "actors"
                  ],
                  "on": [
                     "actors_ids",
                     "id"
                  ],
                  "request": {
                     "query": {
                        "match_all": {}
                     }
                  }
               }
            },
            {
               "join": {
                  "indices": [
                     "countries"
                  ],
                  "on": [
                     "country_id",
                     "id"
                  ],
                  "request": {
                     "query": {
                        "match_all": {}
                     }
                  }
               }
            }
         ]
      }
   }
}
2 Likes

ok, I will try, thank you