Multiple Facet Searches

Hi,

I am trying to run a search query using multiple facets, and I want the
facet numbers to update in the same way as the site Zappos does. For
example, when I search for Nike in the men's shoe section, I get facets for
Brand and Color.

https://lh6.googleusercontent.com/-3upIQdUCw7s/UfvBXZ8J9rI/AAAAAAAAJiE/Fv0SYGcfOD8/s1600/Screen+Shot+2013-08-02+at+9.05.44+AM.png

When I narrow my search by Brand (by selecting 'Nike'), the numbers within
the Brand facet do not change, but the numbers within the Color facet
change to reflect the narrowed search results.

https://lh3.googleusercontent.com/-PwDqkB4r49M/UfvBiNCP-fI/AAAAAAAAJiM/OK-LHewj4k4/s1600/Screen+Shot+2013-08-02+at+9.07.05+AM.png

I can widen my search by selecting 'Nike Action', and still no numbers
within the Brand facet are updated, but numbers in the Color facet have
been updated to reflect the additional results.

https://lh3.googleusercontent.com/-0sBDHJLzwxc/UfvBpbV-X5I/AAAAAAAAJiU/dXU48nPUqXs/s1600/Screen+Shot+2013-08-02+at+9.08.20+AM.png

I can see the same expected results if I select a term within the Color
facet:

https://lh5.googleusercontent.com/-eN0havFUmZs/UfvBufhko6I/AAAAAAAAJic/Nf__QYsUr_c/s1600/Screen+Shot+2013-08-02+at+9.09.32+AM.png

I can think of two ways to do this using Elastic Search, and I'm looking
for any guidance/suggestions as to the best way to implement this.

  1. Filtered query using fairly complex facet filters within each facet,
    including global = true flag.

  2. Top-level filter (which I understand does not affect the facet results)
    with slightly less complex facet filters within each facet

Which of the two options would perform better? Is there a better option
that I'm not thinking of? I can add example JSON if it will help explain my
thoughts.

Thanks!

Bill

PS - Apologies if this hits the group twice. I tried first via email, and
it didn't seem to work.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I would opt for the second suggestion. Your top-level query will have a
filter, but it should not be a filtered query. With a filtered query, the
facets will only be run on the resulting documents, but since you want
every brand, it will not work (unless you use the global flag). With a
normal query/filter query, the facets will be run on the non-filtered
results.

The filter used on the query will be used as a facet filter on the color
facet. The brand facet will have a special filter, which is the one used on
the query, minus the brand filter clause (presumably a term filter).

Cannot say which performs better, but I would assume the global=true option
would not be as performant since you have to filter on all documents.

Cheers,

Ivan

On Fri, Aug 2, 2013 at 7:28 AM, William Finn william.finn@gmail.com wrote:

Hi,

I am trying to run a search query using multiple facets, and I want the
facet numbers to update in the same way as the site Zappos does. For
example, when I search for Nike in the men's shoe section, I get facets for
Brand and Color.

https://lh6.googleusercontent.com/-3upIQdUCw7s/UfvBXZ8J9rI/AAAAAAAAJiE/Fv0SYGcfOD8/s1600/Screen+Shot+2013-08-02+at+9.05.44+AM.png

When I narrow my search by Brand (by selecting 'Nike'), the numbers within
the Brand facet do not change, but the numbers within the Color facet
change to reflect the narrowed search results.

https://lh3.googleusercontent.com/-PwDqkB4r49M/UfvBiNCP-fI/AAAAAAAAJiM/OK-LHewj4k4/s1600/Screen+Shot+2013-08-02+at+9.07.05+AM.png

I can widen my search by selecting 'Nike Action', and still no numbers
within the Brand facet are updated, but numbers in the Color facet have
been updated to reflect the additional results.

https://lh3.googleusercontent.com/-0sBDHJLzwxc/UfvBpbV-X5I/AAAAAAAAJiU/dXU48nPUqXs/s1600/Screen+Shot+2013-08-02+at+9.08.20+AM.png

I can see the same expected results if I select a term within the Color
facet:

https://lh5.googleusercontent.com/-eN0havFUmZs/UfvBufhko6I/AAAAAAAAJic/Nf__QYsUr_c/s1600/Screen+Shot+2013-08-02+at+9.09.32+AM.png

I can think of two ways to do this using Elastic Search, and I'm looking
for any guidance/suggestions as to the best way to implement this.

  1. Filtered query using fairly complex facet filters within each facet,
    including global = true flag.

  2. Top-level filter (which I understand does not affect the facet results)
    with slightly less complex facet filters within each facet

Which of the two options would perform better? Is there a better option
that I'm not thinking of? I can add example JSON if it will help explain my
thoughts.

Thanks!

Bill

PS - Apologies if this hits the group twice. I tried first via email, and
it didn't seem to work.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.