How to get the combined data from two different document?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get the combined data from two different document?

narinder.izap
Hi there,

I have a situation where i need to apply some kind of join in the query, like fetching some data from one document and some from other based on some common attribute value. As for example the two documents are:
type :user


title:"abc",
id:"1",
city:"aaa",
DOB:"10-10-90",
fan_id:"10"


and the second document will be
type : relation


fan_of :"10",
"time_created":"398769978"

now i have to get the users from document type:user  whose fan_of = fan_id and sort the documents by second document  's time_created. Can anyone help me??

Reply | Threaded
Open this post in threaded view
|

Re: How to get the combined data from two different document?

Karussell
Maybe top_children query could help:

http://www.elasticsearch.org/guide/reference/query-dsl/top-children-query.html

Peter.

On Nov 7, 1:14 pm, Narinder Kaur <[hidden email]> wrote:

> Hi there,
>
> I have a situation where i need to apply some kind of join in the query,
> like fetching some data from one document and some from other based on some
> common attribute value. As for example the two documents are:
> *type :user*
>
> title:"abc",
> id:"1",
> city:"aaa",
> DOB:"10-10-90",
> fan_id:"10"
>
> and the second document will be
> *type : relation*
> *
> *
> *
> *
> fan_of :"10",
> "time_created":"398769978"
>
> now i have to get the users from document type:user  whose fan_of = fan_id
> and sort the documents by second document  's time_created. Can anyone help
> me??