Skip to content

Instantly share code, notes, and snippets.

@Nearhan
Created January 6, 2015 13:46
Show Gist options
  • Save Nearhan/842d6ed82982823e47c3 to your computer and use it in GitHub Desktop.
Save Nearhan/842d6ed82982823e47c3 to your computer and use it in GitHub Desktop.
ES
body = {
"aggs" : {
"hashtags" : {
"terms" : {
"field" : "hashtags",
"size": 0
}
}
}
}
def get_hashtag_aggs(index):
res = es.search(index=index, body=body)
return [x.get('key') for x in res.get('aggregations').get('hashtags').get('buckets')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment