elasticsearch - preserving UI in post filter aggregated faceted search -


i'm moving sql server product catalog on elasticsearch , want preserve how ui allows user navigate options. using aggregates post filter cannot selected options siblings show in aggregates.

an example of trying achieve elastic docs.

get /cars/transactions/_search { "size" : 0, "query": {     "match": {         "make": "ford"     } }, "post_filter": {         "term" : {         "color" : "green"     } }, "aggs" : {     "all_colors": {         "terms" : { "field" : "color" }     } } } 

so, user has clicked on green option , returned documents show green ford cars, aggregates list of colors available ford counts, can added ui.

all of ok. but, there many makes of car other ford. if added 'makes' aggregate, query return ford in aggregates list. if building navigation ui dynamically returned results (as am), there no way place other makes of car ui, unless queried elasticsearch many times build ui - don't want do.

if changed query match-all , added query post filter, full list of car makes in aggregation, counts global count match-all query , not reflective of drill-down count.

is possible elasticsearch? i've gone through documents - several times, , tried many different query formats, nothing has produced quite right results far.


Comments