How can I avoid losing data when update es's data by three java threads?

how can i avoid losing data when update es's data by three java threads?
for example:
one message In es

serv_id name age sex
10001 roy 24 boy
while one java thread to update this's age to 25 ,and another thread update name to lily ,
finally,this message is not changed to
serv_id name age sex
10001 lily 25 boy

but to
serv_id name age sex
10001 roy 25 boy

name should be lily ,but is not,i wish somebody to give me a way to avoid it;

i am a Chinese,it‘s my first time to require some helps in English forum,my English is not ok,but i really need your help,Thank you !

These documents should be helpful to you:

In addition to the resources Magnus pointed to, you can also use scripted updates to ensure that updates are executed without affecting each other. This moves the modification of documents to the cluster and automatically retries if there are conflicting updates.

Thank you,i got it.:smile:

thank you very much!:yum: