What is a transaction during the indexing request to E.S ? What is the transaction during the search query request to E.S?

When we are indexing some data into E.S using some java client.

When I make an indexing request to E.S using a method call, the control goes to the E.S client node which would make a index request to ElasticSearch Cluster. I believe when this happens the data to be indexed would be written into memory and then finally persisted to the file system as the index files

What I want to know is when the indexing request is sent, when would the control return back to the java caller ?

Would it be after it is written to the memory

OR

Would it be after it is written to the index files.

Another question :
During Search, what happens as part of a transaction ?

Can someone please help me with understanding this ?