Scripted Field - Pick a value from another document

Hello, i guess similar questions are there, but couldn't find the exact same one...
so i try to describe my problem/need:

I have in an index, documents that describes the actions one application took, with several informations. (in json format). Sometimes the actions states "AutoReply".

In case an "AutoReply" is done, the receiver can give a feedback ( yes / no ) -> this feedbacks creates a completely different document (in the same index) that shares a value with the document above...

now, what i'd like to have is that feedback information displayed on the original document, linking them on that ID... is that somehow possible?
if not through a scripted field, any chance to visualize it with filters?

thanks for you support and have a nice day,
cheers
Hugo

Unfortunately there isn't a mechanism for joining data in Elasticsearch or even Kibana really. Scripted fields work on a per-document basis, and there isn't a way to do a lookup or queue on another document within a scripted fields, but even if you could the performance would be horrible. If both of these documents share a common field and value, then you can absolutely put a search or visualization on a dashboard, then filter by that common value to see both documents, but I doubt that's the experience you really want.

The recommended way to handle this is to store all the information about the first document in that document, and if that means updating it when "the receiver" gives feedback. Rather than just writing a completely different document to the index you could either:

  • modify the original document to include the response
  • include information about the original document in the document created when the response is recorded which includes enough information to visualize just the response documents.
1 Like

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