Please give me some syntax which helps me through it, If possible some links also.
my code:-1:
ObjectMapper mapper = new ObjectMapper();
String path = "C:\Users\Gourav Bhattacharya\Downloads\accounts\accounts.json";
byte[] jsonData = mapper.writeValueAsBytes(path);
//BufferedReader br = new BufferedReader(new FileReader(path));
//System.out.println(br.readLine());
JsonParser parser = new JsonFactory().createParser(jsonData);
String jsonString = parser.getValueAsString();
System.out.println(jsonString);
Map<String, Object> json = new HashMap<String, Object>();
json.put("user","user");
json.put("postDate",new Date());
json.put("message",jsonString);
IndexResponse response = transportClient.prepareIndex("bank", "account", "1")
.setSource(json, XContentType.JSON)
.get();
System.out.println(response.getResult());
String _index = response.getIndex();
String _type = response.getType();
String _id = response.getId();
long _version = response.getVersion();
RestStatus status = response.status();
System.out.println(_index + "\n" +_type+ "\n" + _id + "\n" +_version+ "\n" + status);