Merge data fer two indices with foreign key

Hi,
Can I get the merged data from two different indices?
For example: Index1 : Name, Id , Type
Index2: Type, TypeData1
Type, TypeData2
I want data to be returned in single query like Name,Id,Type:[TypeData1,TypeData2].
Basically, same operation a n inner join does in sql or join in Linq.

Thanks in Advance,,
Regards,
Aneesh

Elasticsearch does not support join queries as per say.

What is the end user need for that? Could you describe what your model is with some basic json documents?

Student
=======
{
	"StudentId":1,
	"StudentName":"abc"
}

Subject
=======
{
	"SubjectId":101,
	"SubjectName":"English"
},
{
	"SubjectId":102,
	"SubjectName":"Science"
}


SubjectAssigned
===============
{
	"SubjectId":101,
	"StudentId":1
},
{
	"SubjectId":102,
	"StudentId":1
}


Student+SubjectAssigned (Need something like this as result)
=======================

{
	"StudentId":1,
	"StudentName":"abc"
	"Subjects":[
		{
			"SubjectId":101,
			"SubjectName":"English"
		},
		{
			"SubjectId":102,
			"SubjectName":"Science"
		}
	]
}

Great. In your use case, what people are going to search for? Students?

Then index:

PUT students/doc/1
{
	"StudentId":1,
	"StudentName":"abc"
	"Subjects":[
		{
			"SubjectId":101,
			"SubjectName":"English"
		},
		{
			"SubjectId":102,
			"SubjectName":"Science"
		}
	]
}

And you're done.

Do you want to search for assignations?
Then index:

PUT assignations/doc/102-1
{
    "SubjectId":102,
    "SubjectName":"Science",
    "StudentId": 1,
    "StudentName": "abc"
}

For example.

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