1

We are using elasticsearch 2.1.2.

And we are reading an excel sheet row by row from a for loop and using its values to save an associated document in each iteration. But everytime this operation is performed, around 5 to 7 documents are found which does not have the updated values. While debugging found that request was prepared with correct value and the index api was called. Also no error was thrown from the code.

We have elasticsearch in cluster mode with 3 nodes.

Code for index request:

IndexRequest indexRequest = new IndexRequest(indexName,docType,documentId).source(document); ActionFuture<IndexResponse> indexActionFuture = client.index(indexRequest);

Note : It's very long flow of code from one file to another, so can't share all of them. Adding just the part where the request is being sent. Have debugged and I know that data is prepared correctly and the document object above is a HashMap with correct data, and also indexName,docType and documentId are correct here. Still some how on calling client.index the document is not indexed in the provided index and doctype.

What can be the possible reason for failure?

Aftab
  • 51
  • 4
  • May you please share some of the code details? How do you loop, how do you do the request, etc. – Nikolay Vasiliev Apr 30 '21 at 15:38
  • @NikolayVasiliev , I have edited the question, and added some code. I am 100% sure that there is nothing to do with the code. It's most probably beacuse of some kind of issue in elasticsearch 2.1.2 or it's java api or may be due to its clustered nature. What your view in this – Aftab May 03 '21 at 02:07
  • Maybe there's some problem with the futures? If there is an error during indexing, Elasticsearch will return an error code, but if you are using futures, it will not crash your app, it will just ignore the failure. Do you check the Elasticsearch return code? How? – Nikolay Vasiliev May 03 '21 at 19:52

0 Answers0