'''public Map<String, Object> view(@PathVariable final String id) throws IOException {
GetRequest request = new GetRequest("company", "employee", id).version(1);
GetResponse getResponse = client.get(request, RequestOptions.DEFAULT);
return getResponse.getSource();
}'''
For this coding it return Json object
But,
''' public String datesearch2() throws IOException
{
SearchRequest searchRequest = new SearchRequest();
searchRequest.indices("winlogbeat-6.5.3-2019.02.01");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.rangeQuery("@timestamp").from("2019-02-01T10:28:13.338Z").to("2019-02-01T10:29:13.385Z"));
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
return searchResponse.toString();
}'''
For this it gives Json as a String in page what i need to do to get as Json object?