Join in elasticsearch

Hi,

in my index i have two types Ads ans Product,

Product :

  • _index: fadel
  • _type: product
  • _id: 103|2
  • _version: 1
  • _score: 1
  • _source: {
    • code: 35569058
    • manufacturer: Packard Bell
    • tax_class_id: [ ]
    • visibility: 4
    • price: [ ]
    • in_stock: 1
    • .....
    • ....

Ads

  • _index: fadel
  • _type: ads
  • _id: 92
  • _version: 1
  • _score: 1
  • _source: {
    • customer_id: 2
    • ads_id: 92
    • product_id: 28
    • price_current: 1200.0000
    • is_pro_customer: 0
    • state: 13
    • qty_current: 19
      }
  • fields: {
    • _parent: 28|2
      }

so how can i get all ads for a product, and how I can retrieve the
associated product to an ad

PS : 1 product may have one or more ads, but an ad associated to 1 product

thank you

--

For information, the same thread is opened on the french ml
https://groups.google.com/d/topic/elasticsearch-fr/N7zxurhUKjI/discussion .

David

Le 28 décembre 2012 à 00:10, Fadel Chafai fadelmohamed@gmail.com a écrit :

Hi,

in my index i have two types Ads ans Product,

Product :

   * _index: fadel
   * _type: product
   * _id: 103|2
   * _version: 1
   * _score: 1
   * _source: {
           o code: 35569058
           o manufacturer: Packard Bell
           o tax_class_id: [ ]
           o visibility: 4
           o price: [ ]
           o in_stock: 1
           o .....
           o ....

Ads

   * _index: fadel
   * _type: ads
   * _id: 92
   * _version: 1
   * _score: 1
   * _source: {
           o customer_id: 2
           o ads_id: 92
           o product_id: 28
           o price_current: 1200.0000
           o is_pro_customer: 0
           o state: 13
           o qty_current: 19
     }
   * fields: {
           o _parent: 28|2
     }

so how can i get all ads for a product, and how I can retrieve the
associated product to an ad

PS : 1 product may have one or more ads, but an ad associated to 1 product

thank you

--

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--