If you already use Elasticsearch, take a look at percolators or percolate queries:
…instead of storing documents and running queries against it, percolation requires to store queries and run documents against it. This is the reason why it is often referred as flipping around query and documents.
In fact, this post by Alexander Reelsen works with your exact use case, but you will find many more articles on the topic.