Skip to content

Instantly share code, notes, and snippets.

View bevankoopman's full-sized avatar

Bevan Koopman bevankoopman

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bevankoopman on github.
  • I am bevankoopman (https://keybase.io/bevankoopman) on keybase.
  • I have a public key ASC36qCF0Ny4SYpBDG1S1BO6BGcCi0uhklBNkzb3FxKXSQo

To claim this, I am signing this object:

Where to from here?

That is the question

HttpPost post = new HttpPost(Configuration.getElasticIndexURL() + "/trial/_bulk");
post.setEntity(new FileEntity(jsonFile));
post.addHeader("content-type", "text/plain");
post.addHeader("Accept", "text/plain");
HttpResponse response = HttpClientBuilder.create().build().execute(post);
if (response.getStatusLine().getStatusCode() == HttpURLConnection.HTTP_OK) {
log.debug("Index complete for " + jsonFile);
} else {
log.warn("Error received when indexings " + jsonFile + " " + new BufferedReader(new InputStreamReader(response.getEntity().getContent())).readLine());