Facet help


(Marco Aurélio Silva) #1

Hi There

I would like to have some help on how to do some things with elastic
search. I have an index with a lot of products that came from some websites
(parsed by a web crawler). I would like to show to my user some filters, so
he can refine his search. I tried to use termFacet on product name, but it
is returning some terms that I don't want to show in the filter. What is
the best approach to do this? Is there a way to query how many know terms I
have in a search result?

Sorry if this doubt is too basic, I don't know where to ask this. Any help
is appreciated!

Thanks in advance
Marco Silva


(Radu Gheorghe) #2

Hi Marco,

On Mar 2, 3:22 pm, Marco Aurélio Silva marc...@gmail.com wrote:

Hi There

I would like to have some help on how to do some things with elastic
search. I have an index with a lot of products that came from some websites
(parsed by a web crawler). I would like to show to my user some filters, so
he can refine his search. I tried to use termFacet on product name, but it
is returning some terms that I don't want to show in the filter.

You can exclude terms that you don't want shown. See "Excluding terms"
here:
http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html

Although I'm not sure this is what you want :-s

What is
the best approach to do this? Is there a way to query how many know terms I
have in a search result?

I'm not sure if it's just me, but I'm not sure what you're trying to
accomplish. Can you rephrase your questions? Maybe come up with an
example?

Sorry if this doubt is too basic, I don't know where to ask this. Any help
is appreciated!

Thanks in advance
Marco Silva


(Marco Aurélio Silva) #3

Hi Radu

Thanks for the reply! Let me try to explain with an example:

When user search for car, I would like to show filters like:

mbw (3)
ford (5)
ferrari (1)

The problem is I don't know the car brand, I just have the name and a
description. If I put a termFace on name or description, it can return
other therms that are not brands... like wheels or some other word that is
common for all cars... right?
What I want to do is, from a list of pre defined brands, know the number of
each on the search result...

Is a good aproach ti create a termFacet for each brand, with a filter on it
(to limit to the brand name)?

On Sat, Mar 3, 2012 at 12:25 PM, Radu Gheorghe radu0gheorghe@gmail.comwrote:

Hi Marco,

On Mar 2, 3:22 pm, Marco Aurélio Silva marc...@gmail.com wrote:

Hi There

I would like to have some help on how to do some things with elastic
search. I have an index with a lot of products that came from some
websites
(parsed by a web crawler). I would like to show to my user some filters,
so
he can refine his search. I tried to use termFacet on product name, but
it
is returning some terms that I don't want to show in the filter.

You can exclude terms that you don't want shown. See "Excluding terms"
here:

http://www.elasticsearch.org/guide/reference/api/search/facets/terms-facet.html

Although I'm not sure this is what you want :-s

What is
the best approach to do this? Is there a way to query how many know
terms I
have in a search result?

I'm not sure if it's just me, but I'm not sure what you're trying to
accomplish. Can you rephrase your questions? Maybe come up with an
example?

Sorry if this doubt is too basic, I don't know where to ask this. Any
help
is appreciated!

Thanks in advance
Marco Silva


(Karussell) #4

well, ElasticSearch cannot do the guess work for you so you'll need to
extract the brand name yourself (from your predefined list - its easy).
then feed it into a brand field ...

Does this help?

Peter.


(Marco Aurélio Silva) #5

Hi Peter

This is what I want to know... is this the right way to do this? Get the
list of terms and see if it is a predefined brand? I'm afraid I have only
one document for one brand, and this term could not be returned right?
Sorry, I have never worked with lucene or elasticsearch before, things are
not clear to me :wink:

Thank you
Marco

On Tue, Mar 6, 2012 at 5:25 AM, Karussell tableyourtime@googlemail.comwrote:

well, ElasticSearch cannot do the guess work for you so you'll need to
extract the brand name yourself (from your predefined list - its easy).
then feed it into a brand field ...

Does this help?

Peter.


(Radu Gheorghe) #6

Hi Marco,

I'm too much of a noob to tell you if there's a right way to do this,
unfortunately.

What I would do is to define one filter facet for each brand in the
predefined list. Then I would run the query with all the facets there.

A bit more on filter facets here:
http://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.html

I hope this helps.

On Mar 5, 9:58 pm, Marco Aurélio Silva marc...@gmail.com wrote:

Hi Radu

Thanks for the reply! Let me try to explain with an example:

When user search for car, I would like to show filters like:

mbw (3)
ford (5)
ferrari (1)

The problem is I don't know the car brand, I just have the name and a
description. If I put a termFace on name or description, it can return
other therms that are not brands... like wheels or some other word that is
common for all cars... right?
What I want to do is, from a list of pre defined brands, know the number of
each on the search result...

Is a good aproach ti create a termFacet for each brand, with a filter on it
(to limit to the brand name)?

On Sat, Mar 3, 2012 at 12:25 PM, Radu Gheorghe radu0gheor...@gmail.comwrote:

Hi Marco,

On Mar 2, 3:22 pm, Marco Aurélio Silva marc...@gmail.com wrote:

Hi There

I would like to have some help on how to do some things with elastic
search. I have an index with a lot of products that came from some
websites
(parsed by a web crawler). I would like to show to my user some filters,
so
he can refine his search. I tried to use termFacet on product name, but
it
is returning some terms that I don't want to show in the filter.

You can exclude terms that you don't want shown. See "Excluding terms"
here:

http://www.elasticsearch.org/guide/reference/api/search/facets/terms-...

Although I'm not sure this is what you want :-s

What is
the best approach to do this? Is there a way to query how many know
terms I
have in a search result?

I'm not sure if it's just me, but I'm not sure what you're trying to
accomplish. Can you rephrase your questions? Maybe come up with an
example?

Sorry if this doubt is too basic, I don't know where to ask this. Any
help
is appreciated!

Thanks in advance
Marco Silva


(system) #7