We have a requirement where we need to combine the documents in search results. Below example depicts it.
Assuming we have two documents say
Teachers.json
{
"id": "Teacher1",
"contextType": "Teacher",
"Subject" : "English"
"foreign_key": [
"Student1"
]
}
Student1.json
{
"id": "Student1",
"contextType": "STUDENT"
}
So, the requirement is that we need to display the combined output in a single document, as below
"response": {
"numFound": 1,
"start": 0,
"docs": [
{
"id": "Teacher1",
"contextType": "TEACHER",
"Subject" : "English",
"Student":[{
"id": "Student1",
"contextType": "STUDENT"
}],
}
]
}
I tried using parent child relationships in elastic search, but didnt had any luck.
Please let me know if this is possible in elastic search
P.S : I am new bie to elastic search