Faceted Search Basics


(elljoh-2) #1

Hi,

I was encouraged to learn that Elastic supports facets.

Given a search result set, I would like to have access to the distinct
values of facets to drive dimensional pivots through browsing the
results: even if the distinct value set for a facet is the values of a
particular field. err...What does "he" mean?...

e.g. Say I have a product inventory catalog that contains fields such
as {desc,location, type, msrp}.

If a user searches for "desc" : "frotz", and that result set contains
1000 hits, I want to have "buckets" of distinct values for those hits
in facets for {location, type, msrp} in the results. This will help in
directing the user for subsequent query refinement (would be nice to
have range buckets for numerics such as msrp).

However, looking at the the facet examples on
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/ I
only see a facet query for specific terms and the result is a count of
hits for that query. I wont know distinct valid values for a facet;
this is what I would like Elastic to tell me as part of the search
results :slight_smile:

Is there a way to achieve what I describe above with facets using a
different query DSL spec inside the facet? e.g. a wildcard or
something else. Or is there a different common practice to achieve
this in Elastic?...

Cheers, elljoh

ps: (inadvertently posted on the nabble mirror...hope the plumbing is
correct now :wink: apologies for the dupe...)


(Bart Schuller) #2

On May 26, 2010, at 14:57, elljoh wrote:

However, looking at the the facet examples on
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/ I
only see a facet query for specific terms and the result is a count of
hits for that query. I wont know distinct valid values for a facet;
this is what I would like Elastic to tell me as part of the search
results :slight_smile:

It's a two-step process. The distinct values can be fetched first using the Terms API http://www.elasticsearch.com/docs/elasticsearch/rest_api/terms/

It would be nice if there was a way to combine facets with terms so you could say: query for this facet for all the terms available in the index.

--
Bart.Schuller@gmail.com


(Shay Banon) #3

Agreed, thats the best way to solve this now. I completely agree with the
requirement, and this is the type of requirements I think facets need to
support (I don't even place them under a facet). I have an idea on how to
implement that and several other features (like custom scoring), but it
requires building a bit of infrastructure for it.

I am working on it, first mentally ;), and then will code it. It is
certainly on my road map, and really eager to do it. One thing to note here
(and it applies to geo support as well) is that next Lucene version has made
substantial changes in those areas, so its delicate to implement this and
make sure to maintain backward compatibility.

On Wed, May 26, 2010 at 5:12 PM, Bart Schuller Bart.Schuller@gmail.comwrote:

On May 26, 2010, at 14:57, elljoh wrote:

However, looking at the the facet examples on
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/ I
only see a facet query for specific terms and the result is a count of
hits for that query. I wont know distinct valid values for a facet;
this is what I would like Elastic to tell me as part of the search
results :slight_smile:

It's a two-step process. The distinct values can be fetched first using the
Terms API http://www.elasticsearch.com/docs/elasticsearch/rest_api/terms/

It would be nice if there was a way to combine facets with terms so you
could say: query for this facet for all the terms available in the index.

--
Bart.Schuller@gmail.com


(elljoh-2) #4

Thanks guys...

Clarification much appreciated.

Will be keenly following the facet (or other pending name ;)...) other
road map. For now the bifurcated process will work just fine. Also
understood is the careful approach to maintaining consistency with the
direction that similar features take within Lucene.

Thanks again...See you on the list...

Cheers, elljoh

On May 27, 9:35 am, Shay Banon shay.ba...@elasticsearch.com wrote:

Agreed, thats the best way to solve this now. I completely agree with the
requirement, and this is the type of requirements I think facets need to
support (I don't even place them under a facet). I have an idea on how to
implement that and several other features (like custom scoring), but it
requires building a bit of infrastructure for it.

I am working on it, first mentally ;), and then will code it. It is
certainly on my road map, and really eager to do it. One thing to note here
(and it applies to geo support as well) is that next Lucene version has made
substantial changes in those areas, so its delicate to implement this and
make sure to maintain backward compatibility.

On Wed, May 26, 2010 at 5:12 PM, Bart Schuller Bart.Schul...@gmail.comwrote:

On May 26, 2010, at 14:57, elljoh wrote:

However, looking at the the facet examples on
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/I
only see a facet query for specific terms and the result is a count of
hits for that query. I wont know distinct valid values for a facet;
this is what I would like Elastic to tell me as part of the search
results :slight_smile:

It's a two-step process. The distinct values can be fetched first using the
Terms APIhttp://www.elasticsearch.com/docs/elasticsearch/rest_api/terms/

It would be nice if there was a way to combine facets with terms so you
could say: query for this facet for all the terms available in the index.

--
Bart.Schul...@gmail.com


(system) #5