Last active
July 13, 2016 00:31
-
-
Save bevankoopman/6c135682a73dfefba23d1a106a1d4d14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment