Skip to content

Instantly share code, notes, and snippets.

@jettro
Created October 13, 2015 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jettro/d9c8bda910ead1ce0f92 to your computer and use it in GitHub Desktop.
Save jettro/d9c8bda910ead1ce0f92 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
curl "localhost:9200/crowdcontrol/_search?pretty&search_type=count" -d '{
"query": {
"term": {"roomId":"foyer"}
},
"aggs": {
"byRoom": {
"terms": {
"field":"roomId"
},
"aggs": {
"histo": {
"date_histogram": {
"field": "timestamp",
"interval": "5m",
"format" : "yyyy-MM-dd HH:mm:ss"
},
"aggs": {
"people_in_room": {
"sum": {
"field":"action"
}
},
"total_people_in_room": {
"cumulative_sum": {
"buckets_path": "people_in_room"
}
}
}
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment