Terms-stats facet and aggregation


(seb-2) #1

Hi

I have a question, I don'r know if it's possible
I use Terms Stats Facet (http://www.elasticsearch.org/guide/reference/
api/search/facets/terms-stats-facet.html) and I'd like to get more
information.

For example, the demo code on the doc is

"facets" : {
    "tag_price_stats" : {
        "terms_stats" : {
            "key_field" : "tag",
            "value_field" : "price"
        }
    }
}

suppose that we have tag and price in the index
If now we also have category, I'd like to know for each terms_stats
facet value the list of categories included in the facet.

something like this

{
    "term" : "book",  ## book is the tag
    "count" : 10,
    "total_count" : 10,
    "min" : 170.489,
    "max" : 170.514,
    "total" : 1705.0390000000002,
    "mean" : 170.50390000000002
    "category": ["ruby", "java", "C++] ## What I'd like to have
  },

Is that possible?

thanks a lot


(system) #2