ES "Join" making query over another query's result and aggregation

Hi all,

I have a use case where I want to have FTS (Full-Text-Search) over my corpus on ES which includes few documents over a single index.

This part is easy, but I have another index (BTW, there may be that my design of indexes is wrong, I would love to hear better design) where I set another metadata per each term in the document (e.g. term is a verb/noun/name/etc. and more..). This I do by indexing the term's index/position within the document (a.k.a "reverse index").

Now, assuming ES query's results returns some match documents, I would like also to return the metadata of processed terms.

For example:

Assuming querying the phrase "trip to London" and ES found 2 match documents (assuming ids are Doc_1 & Doc_2).

I would like also to return to the user these document ids and the metadata of processed query (e.g. "trip" & "london") within these two docs. For example:

Response would be by relevancy:

Doc_1, metadatas: [{16, verb}, {22, noun}]
Doc_2, metadatas: [{55, name}, {88, noun}]

note: numbers above 16,22,55,88 are the terms' index within the documents.

How can I make such kind of search efficiency?

I though using the "highlighting" feature of ES but not sure it would help.

Thanks.

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