Guest User

Untitled

a guest
Sep 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. Map<String, Object> attachment = new HashMap<String, Object>();
  2. attachment.put("content", attachmentContent);
  3. attachment.put("_indexed_chars", -1); // no limit
  4.  
  5. fileProperties.put("file", attachment);
  6. fileProperties.put("postID", postID);
  7. fileProperties.put("filename", file.getFilename());
  8. fileProperties.put("path", file.getPath());
  9. fileProperties.put("fileSize", file.getFileSize());
  10.  
  11. UpdateResponse updateResponse = new UpdateRequestBuilder(transportClient,
  12. "threads",
  13. "thread,
  14. threadID)
  15. .setScript("ctx._source.files += file")
  16. .addScriptParam("file", fileProperties)
  17. .execute().actionGet();
Add Comment
Please, Sign In to add comment