How can i merge 2 different types

I need to merge two different 'types' (or two different 'indexes', even if this is a less preferred method) in ElasticSearch 5.6
This is the first type 'flag'
{
"_index": "flags",
"_type": "flag",
"_id": "1",
"_score": 1,
"_source": {
"title" : "Sad title is here"
"user_id" : 2
}
}
Here's the second 'user'
{
"_index": "flags",
"_type": "user",
"_id": "2",
"_score": 1,
"_source": {
"username" : "john doe"
}
}
The value of 'user_id' in type 'flag' is equal to the '_id' of the second type named 'user'
This is the result we're trying to get:
{
"_index": "flags",
"_type": "flag",
"_id": "1",
"_score": 1,
"_source": {
"title" : "Sad title is here"
"user_id" : 2,
"username" : 'john doe'
}
}
If it is possible to get the result by using different indeces instead of 'types', that is ok as well, but less preferred.

Knowing that types are going to be removed I think it’s a good idea to do that.

This is something you need to solve IMO on the application side (ingestion side) or with an ETL.

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