Guys, I am working on very simple ES plugin in common with "elasticsearch-mapper-attachments" plugin.
My goal is to perform some analysis on the document content, in ES index stage, and output the result of the analysis into JSON structure.
All works pretty fine - thank you ES team.
In order to perform analysis the document on index stage I use regular implementation of AbstractFieldMapper and do my work in parse(ParseContext context) method. I see that #parse method is invoked as consequence of 2 events: insert document and update document.
As plugin optimisation I would like to run document analysis only when the new document is created. If the document is updated I would like to bypass the logic into #parse method.
My data is coming from river.
So the question in the front of me is - how I can detect the root event of the #parse method invocation?