I asked this question here: http://stackoverflow.com/questions/42830378/how-to-reverse-search-given-a-new-document-in-the-query-in-elasticsearch
But here it goes:
Here's the usecase:
I have a few types, let say city, country, music genre, music artist, etc., and given a sentence, I'd like to find all instances of any of those types in my given sentence.
How should I do it in Elasticsearch?
I'm thinking of putting the entities (city, country, etc.) each in a type, and then ideally, I'll give a sentence, and it would find all instances of them for me.
So for instance, if I have these:
city: [berlin, paris]
music-genre: [jazz, blues]
and I give the sentence "I like jazz festivals in berlin", then it should return me:
jazz: position X, score 1
berlin: position Y, score 1
So in a sense, instead of having I like jazz festivals in berlin
as a document and then searching for berlin
or jazz
, the sentence is the query and berlin
and jazz
are the documents.