Last active
          December 21, 2015 04:28 
        
      - 
      
- 
        Save joshski/6249191 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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}' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
it works