Hi, I have some trouble making my bulk-update API work.
I have Elasticsearch 6.2.
So here the SQL request:
String sqlBulk = "SELECT id "
+ "from table tab "
+ "ORDER BY tab.ID ASC LIMIT ? ";
PreparedStatement preparedStatement = connection.prepareStatement(sqlBulk);
preparedStatement.setInt(1, 1);
ResultSet reSet = preparedStatement.executeQuery();
And there the connection to ES, creation of the bulk and the map.
RestHighLevelClient client = new RestHighLevelClient(
RestClient.builder(
new org.apache.http.HttpHost("localhost", 9200, "http")));
BulkRequest request = new BulkRequest();
while (reSet.next()) {
Map<String, Object> jsonMap = new HashMap<>();
jsonMap.put("comment", "daily update");
jsonMap.put("the_id", reSet.getString("tab.id"));
request.add(new UpdateRequest("entite", "doc","101")
.doc(jsonMap, XContentType.JSON));
}
And here's when the bulk is supposed to be sent.
BulkResponse bulkResponse = client.bulk(request);
It supposed to update one document (the 101) with the field comment (with the string "daily update") and the field the_id (with the id found).
The program run but nothing get updated. Do you have any ideas?