Skip to content

Instantly share code, notes, and snippets.

@joshski
Last active December 21, 2015 04:28
Show Gist options
  • Save joshski/6249191 to your computer and use it in GitHub Desktop.
Save joshski/6249191 to your computer and use it in GitHub Desktop.
echo
echo "DELETE INDEX"
echo
curl -w "\r\n" -X DELETE http://localhost:9200/temp-index
echo
echo "CREATE MAPPINGS"
echo
curl -w "\r\n" -X POST http://localhost:9200/temp-index -d '{"mappings":{"product":{"properties":{"name":{"type":"string","analyzer":"snowball"},"tags":{"type":"string","index":"not_analyzed"},"url":{"type":"string","index":"not_analyzed"},"image":{"type":"string","index":"not_analyzed"},"class":{"type":"string","index":"not_analyzed"},"publisher":{"type":"string","index":"not_analyzed"}}}},"settings":{}}'
echo
echo "CREATE PRODUCT"
echo
curl -w "\r\n" -X POST "http://localhost:9200/temp-index/product/" -d '{"class":"Clothing & Accessories","image":"http://some/image","publisher":null,"tags":["accessories","basketball"],"name":"Jazzy Trousers","url":"http://some/url"}'
echo
echo "REFRESH INDEX"
echo
curl -w "\r\n" -XPOST 'http://localhost:9200/temp-index/_refresh'
echo
echo "SEARCH PRODUCTS"
echo
curl -w "\r\n" -X GET 'http://localhost:9200/temp-index/product/_search?size=20' -d '{"query":{"bool":{"must":[{"term":{"class":{"term":"Clothing & Accessories"}}},{"query_string":{"query":"*","default_operator":"AND"}}]}},"facets":{"class":{"terms":{"field":"class","size":20,"all_terms":false}},"tags":{"terms":{"field":"tags","size":30,"all_terms":false}}},"size":20,"version":true}'
@joshski
Copy link
Author

joshski commented Sep 9, 2013

it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment