Created
January 25, 2017 10:47
-
-
Save danielpereirabp/bc4954bf24bf1e7e2878fc7c03bc71df to your computer and use it in GitHub Desktop.
Elasticsearch Group By
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
POST /questoes_sf/questao/_search | |
{ | |
"size": 0, | |
"query": { | |
"term": { | |
"instituicao.dominio": "na" | |
} | |
}, | |
"aggs": { | |
"group_by_comparador": { | |
"terms": { | |
"field": "comparador", | |
"size": 0, | |
"order": { | |
"_count": "desc" | |
}, | |
"min_doc_count": 2 | |
}, | |
"aggs": { | |
"questoes": { | |
"terms": { | |
"field": "id", | |
"size": 0 | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment