Skip to content

Instantly share code, notes, and snippets.

@thesurlydev
Created March 26, 2012 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thesurlydev/2209383 to your computer and use it in GitHub Desktop.
Save thesurlydev/2209383 to your computer and use it in GitHub Desktop.
ES update
Map<String, Object> attachment = new HashMap<String, Object>();
attachment.put("content", attachmentContent);
attachment.put("_indexed_chars", -1); // no limit
fileProperties.put("file", attachment);
fileProperties.put("postID", postID);
fileProperties.put("filename", file.getFilename());
fileProperties.put("path", file.getPath());
fileProperties.put("fileSize", file.getFileSize());
UpdateResponse updateResponse = new UpdateRequestBuilder(transportClient,
"threads",
"thread,
threadID)
.setScript("ctx._source.files += file")
.addScriptParam("file", fileProperties)
.execute().actionGet();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment