Query attachment arrays [ingest mapper plugin]


(Gianni Livolsi) #1

Using this example i'm well indexing an array of attachments,

When i query the index i get as result the full document, how can i know in wich attachment is the queried text..?? This is needed because i store the original document outside of elastic and i need get the full path of it.

Tnx


(David Pilato) #2

It's not a question related to ingest attachment but on how to query when you have an array of objects and get the hit which matched.

You need to adapt your mapping and use nested documents. Then you will be able to use https://www.elastic.co/guide/en/elasticsearch/reference/5.3/search-request-inner-hits.html


(David Pilato) #3

Or even better flatten your model and don't index an array of attachments but have one document per attachment.


(Gianni Livolsi) #4

Tnx David as suggested i've adapted the mapping to an array of nested documents and queried it with the nested query syntax with hinner_hits and hilight is exactly what i need..!!

Tnx


(system) #5

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