Is this use of Facets bonkers?


(Timber) #1

Hi,

On an e-commerce site I want to display the facets from a search so
that you don't need to remove a current facet selection before you can
select a different one. Once you select an age range (9-12 years for
example) the search will return with only the selected age range in
the age range facet. I want to display all the possible age range
facets (taking account of all the other facets selected) with the 9-12
years selected.

To do this I am contemplating reissuing the query for each facet in
turn without the filter applied for that particular facet so that I
can obtain the list of possible options available for this facet.

The problem in doing this is that it will require an extra query for
each facet that we want to display. Can I assume that I can maintain
acceptable performance by using more servers and issuing the extra
queries in parallel? Can anybody think of a less clumsy solution to
this?

Thanks

Tim


(Shay Banon) #2
    Hi,  If I understood correctly the question, then you can do all with a single search request. Use the range facet to define several ranges and you can get count on them. And have two of those, one that is global (not bounded by the user query) and one that isn't (bounded by the use query). Note that each facet can also have an addition filter to further restrict the docs it will run on.-shay.banon
	
	
    On Saturday, November 20, 2010 at 2:58 PM, Timber wrote:
    
        Hi,On an e-commerce site I want to display the facets from a search sothat you don't need to remove a current facet selection before you canselect a different one. Once you select an age range (9-12 years forexample) the search will return with only the selected age range inthe age range facet. I want to display all the possible age rangefacets (taking account of all the other facets selected) with the 9-12years selected.To do this I am contemplating reissuing the query for each facet inturn without the filter applied for that particular facet so that Ican obtain the list of possible options available for this facet.The problem in doing this is that it will require an extra query foreach facet that we want to display. Can I assume that I can maintainacceptable performance by using more servers and issuing the extraqueries in parallel? Can anybody think of a  less clumsy solution tothis?ThanksTim

(Timber) #3

That works a treat.

Thank you

On Nov 20, 1:06 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

    Hi,  If I understood correctly the question, then you can do all with a single search request. Use the range facet to define several ranges and you can get count on them. And have two of those, one that is global (not bounded by the user query) and one that isn't (bounded by the use query). Note that each facet can also have an addition filter to further restrict the docs it will run on.-shay.banon

    On Saturday, November 20, 2010 at 2:58 PM, Timber wrote:

        Hi,On an e-commerce site I want to display the facets from a search sothat you don't need to remove a current facet selection before you canselect a different one. Once you select an age range (9-12 years forexample) the search will return with only the selected age range inthe age range facet. I want to display all the possible age rangefacets (taking account of all the other facets selected) with the 9-12years selected.To do this I am contemplating reissuing the query for each facet inturn without the filter applied for that particular facet so that Ican obtain the list of possible options available for this facet.The problem in doing this is that it will require an extra query foreach facet that we want to display. Can I assume that I can maintainacceptable performance by using more servers and issuing the extraqueries in parallel? Can anybody think of a  less clumsy solution tothis?ThanksTim

(system) #4