I'm afraid I did not understand your question.
Here is some comment.
"facets": {
"colors": { <- this is a name you give to the facet
"terms": {
"field": "colors", <- the field you compute on
"all_terms": true
}
}
What is your concern here?
You just add this facet request with the search request and you get back hits and computed facet (with the same name you give).
Did you read this page? http://www.elasticsearch.org/guide/reference/api/search/facets/
HTH
David 
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
Le 6 févr. 2013 à 22:00, jtreher@gmail.com a écrit :
It might be because I'm low on energy, but I'm having a real tough time reconciling facet structure in my head right now. Does anyone know of a good gist/blog example reference with some real world examples? I've been good with the documentation except for facets, even though the samples work well.
I'll give you an example below. Every example has the facet grouping explicitly set:
"facets": {
"colors": { <- How is this grouping field dynamic to just match the field name?
"terms": {
"field": "colors",
"all_terms": true
}
}
I'm also struggling with documents that can contain any variety of facets. Some have none, some have many.
Thanks!
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.