Skip to content

Instantly share code, notes, and snippets.

@NathBabs
Last active April 30, 2022 19:15
Show Gist options
  • Save NathBabs/5c6c5d7e4b881dc2a6db4c5f0234a47d to your computer and use it in GitHub Desktop.
Save NathBabs/5c6c5d7e4b881dc2a6db4c5f0234a47d to your computer and use it in GitHub Desktop.
ElasticSearch Sum and Terms combination
"aggs": {
"bank_card_metrics": {
"terms": {
"field": "cardBank.keyword"
},
"aggs": {
"cards": {
"terms": {
"field": "cardType.keyword"
},
"aggs": {
"volume": {
"terms": {
"field": "transactionStatus.keyword"
},
"aggs": {
"totalValue": {
"sum": {
"field": "amount"
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment