ElasticSearch grouping facets -
i have document such structure:
{ id: 312256, name: "somename", filterblocks: [{ id: 0 filtertypeid: 4 filteritems: [ 1190 ] }, { id: 0 filtertypeid: 3 filteritems: [ 353 ] }, { id: 234 filtertypeid: 1 filteritems: [ 6342 ] } ] }
for each distinct combination of filterblocks.id+filterblocks.filtertypeid need n size facets on filteritems field. try use query like:
{ "query": { "match_all": {} }, "facets": { "filterblocks": { "terms": { "field": "filterblocks.filteritems" } } } }
but of course n facets without grouping filterblocks.id+filterblocks.filtertypeid
what' need modify in query or document structure right? thank's
you need first query filterblocks.id/filterblocks.filtertype combinations, iterate through results build facet search facet filter each combination.
using terms facet on first query way unique set of results.
Comments
Post a Comment