Hello I'm trying to build an index using elasticsearch java api with java restHighLevelClient, but for some reasons I have an and index failure exception which returns null
.
I'll like to know the reason so that I can improve the input data at least.
Thank in advance for the answer.
P.S: the code is below
private void index(String id,IndexRequest indexRequest){
restHighLevelClient.indexAsync(indexRequest, new ActionListener<IndexResponse>() {
@Override
public void onResponse(IndexResponse indexResponse) {
successFullIndex++;
System.out.println("response status: "+ indexResponse.status().toString()+", response: "+ indexResponse.toString());
}
@Override
public void onFailure(Exception e) {
unsuccessfullIndex++;
String message = id +" "+e.getMessage();
System.out.println("index response exception from : " +message);
try {
FileWriter fileWriter = new FileWriter("indexErrors.txt",true);
fileWriter.write(message+ "\n");
fileWriter.flush();
fileWriter.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}