Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create a few vehicles with different types
- POST /vehicles_type_agg_test/_bulk
- {"index":{"_id":"honda_civic","_type": "car"}}
- {"make": "Honda", "model": "Civic"}
- {"index":{"_id":"honda_accord","_type": "car"}}
- {"make": "Honda", "model": "Accord"}
- {"index":{"_id":"tesla_roadster","_type": "car"}}
- {"make":"Tesla", "model": "Roadster"}
- {"index":{"_id":"audi_a4","_type": "car"}}
- {"make":"Audi", "model": "A4"}
- {"index":{"_id":"bmw_f_650_gs","_type": "motorcycle"}}
- {"make": "BMW", "model": "F 650 GS"}
- {"index":{"_id":"honda_anf125i_innova","_type": "motorcycle"}}
- {"make":"Honda", "model": "ANF125i Innova"}
- # Count vehicles by _type (you cannot use ?type=count for this)
- GET /vehicles_type_agg_test/_search
- {
- "size": 0,
- "aggs": {
- "type": {
- "terms": {
- "field": "_type"
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement