Last active
August 29, 2015 14:18
-
-
Save frodopwns/ec4233e349dc3e396abc to your computer and use it in GitHub Desktop.
elastic aggs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import elasticsearch | |
from pprint import pprint | |
es = elasticsearch.Elasticsearch() | |
query = {'size': 0, 'aggs': {'institutions': {'terms': {'field': 'institution', 'size': 10}}}} | |
res = es.search(index='courses', doc_type='class', body=query) | |
pprint(res['aggregations']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment