Is it possible to combine two docs in different indices?

Hello guys!
If I have two docs in two different indices.
One doc in index "content" is like this

{
    "id": "content_id",
    "content": random content,
    "user_details":{
      "user_id":"123"
      }
}

and another doc in another index "user_info" is like this

{
    "id": "user_info_id",
     "user_id": "123,
     "avatar" : "https://xxx.xxx",
     "username" : "xxxx"
}

Can I combine these two docs filtered by field "user_id" like this? Just like $lookup in MongoDb?

{
    "id": "content_id",
    "content": random content,
    "user_details":{
      "user_id":"123"
      "avatar" : "https://xxx.xxx",
      "username" : "xxxx"
      }
}

Welcome to our community! :smiley:
We aren't all guys though :slight_smile:

You should be able to do this with a Transform - Transforming data | Elasticsearch Guide [7.13] | Elastic. Otherwise you will want to merge both documents before sending to Elasticsearch.

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