Inserting records in elasticsearch

Hi everybody,

I am running a loop and and creating an xmlhttprequest for posting records in elasticsearch per iteration.
My loop iteration is completed in seconds but complete insertion in elasticsearch takes minutes.
So, my question is, is there any method with the help of which we can instantly insert records in elasticsearch.

Instantly? No.
There are a bunch of things that need to happen, however you can look at using the _bulk API though, it might help.