For my project, I choose to :
Persist my top entity with Hibernate
Send this top object to an ActiveMQ queue in the same transaction
Then, my jms queue handle some work (pdf rendering, JSON convert and push to ES)
So it's not real time but in most case, near to real time.
BTW, pushing documents to ES is not really the most time consuming (not sure it's the right english expression !). I only make it asynchronous because I have other works to do with my entities.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.