Searching a index of interests with a sentence

问题描述 投票:0回答:1

No, that's not a mistake, the title is correct. I realize that its backwards from the way search usually works, but here is my situation:

I have an index of interests.....multiple word interests, for example:

{Boxing, Jumping, Breaking Bad, University of Michigan }

and what I would like to do is each time a user submits a status do a search on the interests index and find all the interests the status should be tagged with fairly good accuracy so that I can then permanently tag this status with these topics so that later on I can quickly retrieve a feed of all the statuses relating to a user's interests. What would be the best way of going about this? I have tried common_terms but it does not seem to work with much accuracy due to the query string being an entire sentence.

elasticsearch dsl
1个回答
2
投票

This is the great use case for percolation. Fundamentally, percolation takes a set of queries and runs a document through this set of queries in an optimized way. The way I understand it, elasticsearch basically creates an in memory mini-index of the document and then runs the queries through en masse.

You need to switch your "index of interests" to an stored percolators for your actual data index. You can then either percolate, get the matches, add to doc and index or simply index

© www.soinside.com 2019 - 2024. All rights reserved.