Skip to content

Instantly share code, notes, and snippets.

@ryantbrown
Last active February 27, 2018 19:39
Show Gist options
  • Save ryantbrown/a8319d32b3820804ba6322e46815453a to your computer and use it in GitHub Desktop.
Save ryantbrown/a8319d32b3820804ba6322e46815453a to your computer and use it in GitHub Desktop.
Elastic search nested aggregate with nested query
GET influencers/_search
{
"size": 0,
"aggregations": {
"influencers": {
"nested": {
"path": "interests"
},
"aggs": {
"names": {
"filter": {
"bool": {
"must": [
{
"match": {
"interests.name": "Travel destinations"
}
}
]
}
},
"aggs": {
"max_score": {
"max": {
"field": "interests.score"
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment