Skip to content

Instantly share code, notes, and snippets.

Created December 3, 2014 14:04
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 anonymous/391b510dfc9467158a8b to your computer and use it in GitHub Desktop.
Save anonymous/391b510dfc9467158a8b to your computer and use it in GitHub Desktop.
[
{
"index": "myrecords",
"type": "eachrecord"
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "year"
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "in"
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "quarter"
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "month",
"size": 12
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
},
"each": {
"terms": {
"field": "year",
"size": 3
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "type"
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "rType"
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "store",
"size": 10,
"order": {
"total_sum": "desc"
}
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
},
"each": {
"terms": {
"field": "in",
"size": 1
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "product",
"size": 10,
"order": {
"total_sum": "desc"
}
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
},
"each": {
"terms": {
"field": "type",
"size": 1
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"calibrationOne": {
"terms": {
"field": "calibrationOne",
"size": 5,
"order": {
"actual_count": "desc"
}
},
"aggs": {
"actual_count": {
"cardinality": {
"field": "customerId",
"precision_threshold": 5000
}
},
"each": {
"terms": {
"field": "year"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"calibrationTwo": {
"terms": {
"field": "calibrationTwo",
"size": 5,
"order": {
"actual_count": "desc"
}
},
"aggs": {
"actual_count": {
"cardinality": {
"field": "customerId",
"precision_threshold": 5000
}
},
"each": {
"terms": {
"field": "year"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"calibrationThree": {
"terms": {
"field": "calibrationThree",
"size": 5,
"order": {
"actual_count": "desc"
}
},
"aggs": {
"actual_count": {
"cardinality": {
"field": "customerId",
"precision_threshold": 5000
}
},
"each": {
"terms": {
"field": "year"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"calibrationFour": {
"terms": {
"field": "calibrationFour",
"size": 5,
"order": {
"actual_count": "desc"
}
},
"aggs": {
"actual_count": {
"cardinality": {
"field": "customerId",
"precision_threshold": 5000
}
},
"each": {
"terms": {
"field": "year"
}
}
}
}
}
},
{
"size": 0,
"aggs": {
"total_cost": {
"terms": {
"field": "store",
"size": 50,
"order": {
"total_sum": "desc"
}
},
"aggs": {
"total_sum": {
"sum": {
"field": "paidAmount"
}
},
"each": {
"terms": {
"field": "in"
},
"aggs": {
"lat": {
"terms": {
"field": "lat"
},
"aggs": {
"long": {
"terms": {
"field": "long"
}
}
}
}
}
}
}
}
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment