Last active
August 29, 2015 14:20
-
-
Save hkrishna/727f3db3b8cc7442b83e to your computer and use it in GitHub Desktop.
Categories Aggregation query
This file contains hidden or 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
# get the number of distinct category values in the index | |
curl -XGET "http://localhost:9200/pelias/_search?search_type=count" -d' | |
{ | |
"aggs": { | |
"categories": { | |
"cardinality": { | |
"field": "category" | |
} | |
} | |
} | |
}' | |
# get the number of documents for each category | |
curl -XGET "http://localhost:9200/pelias/_search?search_type=count" -d' | |
{ | |
"aggs": { | |
"categories": { | |
"terms": { | |
"field": "category", | |
"size": 107 | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment