How to convert update method to insert-array method (Java)

Hello guys.

Looks like I'm having some issues while updating an array. I think that my code is suffering from delay after the update. This is my code. I'm running it several times. If I put a sleep after the update, it will work. But it is not a good practice and it does not fit on my project.

             listOne.add(peanut); // The listOne is a Set<String>

	UpdateRequest updateRequest = new UpdateRequest();
	updateRequest.doc("listOne",listOne); // The new doc
	element.setListOne(listOne); // Sets the new list for future updates
	// Retry 3 times before failing the update
	client.update(updateRequest).get(); // Updates it

Imagine that i want to add 10 different peanuts. I cannot do it, because with this method, ES will lose data. So I want a method that allows me to store all the data without losing one (or more) of the peanuts. (append the new peanut to the array without visiting the data stored in ES could be a good solution, but I don't know how to implement it).

The version of the ES is 2.3.4.

Thank you guys.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.