I think you must do separate filters to compute the sideways facet counts.

Mike McCandless

http://blog.mikemccandless.com

On Fri, Jan 16, 2015 at 10:15 AM, Bo Finnerup Madsen <bo.gunder...@gmail.com
> wrote:

> Hi,
>
> I am trying to migrate a project from Lucene to elasticsearch, and for the
> most part it is a pleasure :)
> However, I cannot wrap my head around how to recreate the drill sideways
> queries we currently use in Lucene.
>
> The scenario is a basic search page with a free text search and a bunch of
> drill down/sideways facets. In Lucene, the hits that we get for each facet,
> is a correct representation of how many results we would get if that facet
> is used as a limit, but I am unable to do this in elasticsearch...
>
> As an example (full gist available here:
> https://gist.github.com/bogundersen/e9bac02779e1c4a089dc)
>
> I have three items:
> Item 1:
>   language : en_GB,
>   year: 2013,
>   author: [ John, Paul ]
> Item 2:
>   language : en_GB,
>   year: 2012,
>   author: [ John, George ]
> Item 3:
>   language : da_DK,
>   year: 2012,
>   author: [ Ringo ]
>
> Now lets imagine that the user limits to year 2012. If I just include the
> facet in the query ("Search 2" in the gist), I would get the following
> facets:
> year
>   2012 : 2
> author
>   George 1
>   John   1
>   Ringo  1
> language
>   da_DK  1
>   en_GB  1
> The author and language facets show the correct numbers, but the year
> facet only shows year 2012 thereby not allowing the user to select another
> year without deselecting 2012.
>
> A way around this is to use post filters ("Search 3" in the gist), using
> those I get the following facet results:
> year
>   2012 : 2
>   2013 : 1
> author
>   John   2
>   George 1
>   Paul   1
>   Ringo  1
> language
>   en_GB  2
>   da_DK  1
> Here the user is still presented with other years, but the numbers for
> author and language are not correct (e.g. selecting "John" will only give 1
> result, and not two)
>
> The only way I can think of to make this work, is to do separate queries
> for each facet, but that seems counter intuitive and not very performance
> friendly. Any ideas on how to do this in elasticsearch?
>
> --
> Bo Madsen
>
>  --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/2e97801f-a091-4f1d-8e31-1ffb777f287c%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/2e97801f-a091-4f1d-8e31-1ffb777f287c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAD7smRczzTifRND7XokyddfNH%2B050jBUnn%2ByhCLxe-jtYKpYeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to