Aggregates, facets, filters, buckets

I can't seem to wrap my head around all the concepts mentioned so I'll
start by explaining my setup and goal.

  • Elasticsearch 1.4.x
  • 4 indices. Fairy small (couple of thousand documents in each). Lets
    call them "Books", "Users", "Novels", "Poems"
  • NEST client library 1.2.3

Goal is pretty simple: search across those 4 indices in one request and
somehow group results documents by type.
What a end user would like to see is (paginated) list of all documents, and
user should be able to "filter" (consider this a generic concept,
not necessarily a ES filter).
Even more specific... Imagine a search result web page with 5 filters
"All", "Books", "Users", "Novels", "Poems".

I've been fiddling around a lot with aggregates/facets and I can't seem to
get the result I want.

Closest thing was adding aggregate by type to my
query .Aggregations(ag=>ag.Terms("types",t=>t.Field("_type")))

In the response I get aggregate "types", and for each item in types it says
how many documents are there (great!)... "only" thing is, at this point I
don't know how to /get/ those documents by facet key.

It's probably not the way I should go about this problem, so please do
point me to the right direction... Give me a mock query, suggestion,


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
To view this discussion on the web visit
For more options, visit