Find category type base on sub type

(Alexandre Piel) #1

Hi, I am quiet new in elasticsearch and it's very hard to find right solution with all the possibilities elasticsearch offers. So maybe asking question here, will be easier.

I need a way to identify some category, for example if I give "some text labrador" it know that it has to search "some text" in the "dog" category. Would be the same with "some text doberman" "some text pitbull"... Then if I search for "some text maine coon" it know that it has to search for "some text" in the category "cat", the same would apply for "some text birman"...

Right now the only solution I see, is to use synonym, but it doesn't sound right to me. First it will be a huge list, since the breed of pets can be so large. Also there will be problem with compose breed, like "maine coon". And this will also bring synonym conflict, since some breed name could be related to different kind of pet: "siberian husky" and "siberian cat", "york" could be for "cat" and "dog".

What would be the best way to handle such use-case?

1 Like
(Christoph) #2

You could indeed try to handle this problem with synonyms inside Elasticsearch, but as you pointed out this doesn't feel like the best solution. This porblem sounds more like a taxonomy problem to me (see this blog for some discussions around this topic). The synonyms filter in Elasticsearch is a way to handle this, but since most search applications intercept the users search-box input before sending it to Elasticsearch I would personally advise to put some thought into pre-processing the user input with the domain knowledge you have (this could include manually constructed lists of animal names, their synonyms and relations with each other) and then generating an enriched version with that. I'm sure there are also some resources out in the wild that you can leverage with little effort to construct dictionaries with e.g. animal names and concepts around it (Wikipedia and WordNet come to mind).

2 Likes
(Alexandre Piel) #3

Thanks a lot for your answer, it will help us to go in the right direction :wink: