Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. # Create a few vehicles with different types
  2. POST /vehicles_type_agg_test/_bulk
  3. {"index":{"_id":"honda_civic","_type": "car"}}
  4. {"make": "Honda", "model": "Civic"}
  5. {"index":{"_id":"honda_accord","_type": "car"}}
  6. {"make": "Honda", "model": "Accord"}
  7. {"index":{"_id":"tesla_roadster","_type": "car"}}
  8. {"make":"Tesla", "model": "Roadster"}
  9. {"index":{"_id":"audi_a4","_type": "car"}}
  10. {"make":"Audi", "model": "A4"}
  11. {"index":{"_id":"bmw_f_650_gs","_type": "motorcycle"}}
  12. {"make": "BMW", "model": "F 650 GS"}
  13. {"index":{"_id":"honda_anf125i_innova","_type": "motorcycle"}}
  14. {"make":"Honda", "model": "ANF125i Innova"}
  15.  
  16. # Count vehicles by _type (you cannot use ?type=count for this)
  17. GET /vehicles_type_agg_test/_search
  18. {
  19. "size": 0,
  20. "aggs": {
  21. "type": {
  22. "terms": {
  23. "field": "_type"
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement