I have resolved this issue a long time ago, but I have forgotten to write an answer.
I have considered the second solution applying the elasticsearch-jdbc-river which is deprecated as from now when I am writing the answer.
Nevertheless, the problem with the river back then was with considering the default query_timeout option that seems not to be enough by default considering the heave SQL query I was using. The option killed the process after the query_timeout elapsed.
I have increased the query_timeout value and it solved my problem.