Skip to content

Instantly share code, notes, and snippets.

@jsbonline2006
Created February 26, 2014 10:34
Show Gist options
  • Select an option

  • Save jsbonline2006/9227299 to your computer and use it in GitHub Desktop.

Select an option

Save jsbonline2006/9227299 to your computer and use it in GitHub Desktop.
How to join 2 indexes at query time
# delete old index if exists
curl -XDELETE 'http://localhost:9200/offerindex?pretty'
curl -XDELETE 'http://localhost:9200/categoryindex?pretty'
# Create Index
curl -XPUT 'http://localhost:9200/offerindex?pretty' -d '{}'
curl -XPUT 'http://localhost:9200/categoryindex?pretty' -d '{}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/1?pretty' -d '{"skuid": "1983001", "offer_id": "promo00001,promo00002,promo00003"}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/2?pretty' -d '{"skuid": "1983002", "offer_id": "promo00001,promo00002"}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/3?pretty&refresh=true' -d '{"skuid": "1983003", "offer_id": "promo00001,promo00003"}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/1?pretty' -d '{"skuid": "1983004", "offer_id": "promo00001,promo00002,promo00003"}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/2?pretty' -d '{"skuid": "1983005", "offer_id": "promo00001,promo00002"}'
curl -XPUT 'http://localhost:9200/offerindex/offertype/3?pretty&refresh=true' -d '{"skuid": "1983006", "offer_id": "promo00001,promo00003"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/1?pretty' -d '{"skuid": "1983001", "category": "Flat TV"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/2?pretty' -d '{"skuid": "1983002", "category": "Flat TV"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/3?pretty&refresh=true' -d '{"skuid": "1983003", "category": "Flat TV"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/4?pretty' -d '{"skuid": "1983004", "category": "Mobile"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/5?pretty' -d '{"skuid": "1983005", "category": "Mobile"}'
curl -XPUT 'http://localhost:9200/categoryindex/categorytype/6?pretty&refresh=true' -d '{"skuid": "1983006", "category": "Mobile"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment