Elasticsearch one-to-many relations

Hi Everyone,

I have two table in SQL and i want to them to elasticsearch(thier relation is one to many).

Object1:
{
id,
name,
alias,
...
}

Object2:
{
id,
idObject1,
flag,
....
}

I am indexing this relation to elasticsearch like
{
elasticIndex:{
id,
name,
alias,
objects:[
{
id,
idObject1,
flag,
....
},
{
id,
idObject1,
flag,
....
},
]
}
}

Is it possible to return only some of the objects items(maybe there is a 5 record but i want to return 2 record) without id,name,alias,... columns.

Should i create 2 index then join them or 1 index?

Thanks for your helps.

You should denormalize your data and index objects/items one by one of this is what you are searching for.

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