Search term vs Product Category mapping

We are implementing Site search using Elastic Search standalone version.
We need to know how can we direct a search term to a category and list products from that category
**For example : ** Search term is "wash basin tap"

  1. Should match wash basin tap & basin tap in documents
  2. Should not match **wash basin, washbasin alone ** in documents
  3. As wash basin taps type products are mapped under Faucets, Long Bib Taps, Automatic Wash Taps, Need to show products from these categories- How to pull based on "wash basin tap" category ?

Thank & Appreciate all your support & help !

If you need all of the queried terms to match, have a look at the terms set query.

Thanks @Christian_Dahlqvist, But my concern is how can i route my search term to a category
Can i have some custom analyser to do this or any other mapping text file ?

Kindly suggest, Thanks !

For that part I suspect you will need to use 2 separate queries. First get matching items and then other documents that match the categories retrieved.

Is any default mapping feature available in ES for this ?

I am not sure that I understand what you mean. It sounds to me like you want to enrich the initial results based on the data retrieved in the search. This will require 2 separate searches as Elasticsearch does not support joins or subqueries.

Hi @Christian_Dahlqvist,

If i search for "wash basin taps", I need to add Faucets, Long Bib Taps, Automatic Wash Taps categories to my search query against category filed to match & get results.

For this, how can i do a mapping between search terms vs categories. Can it be done via custom analyser or any painless function ? - Just a wild guess, correct me if i am wrong !

Thanks !

I was assuming you perform the search for "wash basin taps" and then extract categories from the results and run a second query to retrieve results matching these categories. Is this not logically what you are looking to do? If you do not get categories from the initial search result, how do you determine them?

If this logically is what you are looking for, I do not see any way of doing that with a single query.

Actually search alone is not giving relevant matches, because different names are present like faucets, handbowl bip tap, long bip taps. Also i should not match "washbasin or wash basin". So i was looking an approach where with some kind of a mapping if i get a list of closest categories, I can do it in a single shot !

Even if i want to do it in 2nd query, the matching may not yield all the categories from 1st query.

FYI: We are searching through fields like Title, Keywords and 3 level categories mainly in ES query. We have a field which stores possible keywords to define this product.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.