Hi guys,
I have been trying unsuccessfully to do a bulk insert with the new Java rest client... Does anyone have a working example of a bulk insert using the rest client ?
I can do searches and index single documents without any issue but no bulk operations. I have tried with pretty much all the types of http entities but I am always getting a 400.
Here is a small example:
StringBuilder batch = new StringBuilder();
String bulkline = "{"index": {}}\n";
batch.append(bulkline);
batch.append("{"kukta": "haha"}");
RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200, "http")).build();
HttpEntity entity = new NStringEntity(batch.toString(), ContentType.APPLICATION_JSON);
Response indexResponse = restClient.performRequest(
"POST",
"/kukta/test/_bulk",
Collections.<String, String>emptyMap(),
entity);
Thanks a lot,
Simeon