How to join 2 indexes at query time


(jsbonline2006) #1

Hi All,

I want to join 2 indexes at query time.
I have created a Gist for this @

I have 2 indexes:

Index 1: offerindex/ Type: offertype
Index 2: categoryindex/ Type: categorytype

Now as per my index data:
My input will be category "Flat TV"
And in output: I want all skuid for "Flat TV" and there corresponding offer_id.

Regards,
Jayesh Bhoyar

GIST @ https://gist.github.com/jsbonline2006/9227299

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/99ad8aa4-dfec-48c1-9605-55c6e3024141%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

Unfortunately, ES is not like SQL in this respect. You'll need to
denormalize somewhat because ES is more "document-oriented". You'd probably
need to either denormalize offer_id into categorytype, or category into
offertype to get all the data you want returned in 1 query.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/750f1c19-4eca-4204-9da0-25783feda996%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(jsbonline2006) #3

Hi Binh,

Thanks for the answer.

Is there any case if I index this data into same index with different
category GIST@ https://gist.github.com/jsbonline2006/9243973
I have 1 index:

productindex/ Type: offertype
productindex/ Type: categorytype

Now as per my index data:
My input will be category "Flat TV"
And in output: I want all skuid for "Flat TV" and there corresponding offer_id.

Regards,
Jayesh Bhoyar

GIST @https://gist.github.com/jsbonline2006/9243973

On Wednesday, February 26, 2014 8:07:01 PM UTC+5:30, Binh Ly wrote:

Unfortunately, ES is not like SQL in this respect. You'll need to
denormalize somewhat because ES is more "document-oriented". You'd probably
need to either denormalize offer_id into categorytype, or category into
offertype to get all the data you want returned in 1 query.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bdd1dd5e-be45-4faa-a01f-f6e491249d65%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Matt Weber) #4

How about using parent/child functionality?

Thanks,
Matt Weber

On Wed, Feb 26, 2014 at 7:45 PM, Jayesh Bhoyar jsbonline2006@gmail.comwrote:

Hi Binh,

Thanks for the answer.

Is there any case if I index this data into same index with different
category GIST@ https://gist.github.com/jsbonline2006/9243973
I have 1 index:

productindex/ Type: offertype
productindex/ Type: categorytype

Now as per my index data:
My input will be category "Flat TV"
And in output: I want all skuid for "Flat TV" and there corresponding offer_id.

Regards,
Jayesh Bhoyar

GIST @https://gist.github.com/jsbonline2006/9243973 https://gist.github.com/jsbonline2006/9243973

On Wednesday, February 26, 2014 8:07:01 PM UTC+5:30, Binh Ly wrote:

Unfortunately, ES is not like SQL in this respect. You'll need to
denormalize somewhat because ES is more "document-oriented". You'd probably
need to either denormalize offer_id into categorytype, or category into
offertype to get all the data you want returned in 1 query.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/bdd1dd5e-be45-4faa-a01f-f6e491249d65%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoCF1hPXeapnrXyPpv3h%3DSetwCPN2MUSV%3DYtNiwW286HWA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5