Compute diff between global and filtered facet filter values

Hello,

I really like the flexibility offered through ElasticSearch with respect to
Facets (i.e. choose to have facet filter values bound or not bound to
query). As with most ecommerce sites, we are initially returning "globally"
selected facets, and then as the user navigates via those facets, we
continue to show the "globally" selected facet filter values and do not
bind them to the filtered query, so that the customer can quickly and
easily navigate many different directions. However, what we would like to
do now is "grey out/disable" those facet filter values, which are no longer
reachable given the filtering the user has chosen. For example, if the
customer has clicked on a specific brand facet filter value, and that facet
click has removed some price range facet filters from contention, then we
would like to disable those selections.

I know we could implement some request/session logic to maintain collection
of initially provided facet filter values and then invoke "filtered"
queries to bind facets to the query and then do a compare between the two
to determine what was eliminated and disable accordingly, but I first
wanted to check with the group here to see if there is a more elegant
solution using ElasticSearch that others may have implemented to do this.

Thanks!

I had a similar requirement a while back and experimented with
ElasticSearch global facets to solve it. I ended up creating two facets per
faceted attribute and merging the calculated facet values. I used the
global facet to basically give me the total value range with 0 hit count.
When merging I basically overwrite the 0 hit count from the global facet
with whatever the actual filtered facet provided. Values not part of the
filtered facet obviously remained with a 0 hit count which can be used
during rendering to disable options. Not sure this is the most elegant way
but it was the only one I found back then.

Thanks Jan! Interesting approach and I will give it a try...

On Tuesday, April 17, 2012 7:02:51 AM UTC-5, Jan Fiedler wrote:

I had a similar requirement a while back and experimented with
Elasticsearch global facets to solve it. I ended up creating two facets per
faceted attribute and merging the calculated facet values. I used the
global facet to basically give me the total value range with 0 hit count.
When merging I basically overwrite the 0 hit count from the global facet
with whatever the actual filtered facet provided. Values not part of the
filtered facet obviously remained with a 0 hit count which can be used
during rendering to disable options. Not sure this is the most elegant way
but it was the only one I found back then.