I have done direct connection with MySQL DB
That's not what I meant. I meant direct connection from your application to elasticsearch. I did not mean reading the data later with Logstash and send to elasticsearch.
The former is "real time". The later is not.
Next time please format your code according to the guide (read the About the Elasticsearch category). I'm editing your post. But your indentation is wrong which makes harder to read your config.
Then, I'm moving your question to logstash as it's a logstash question.