I want to convert the elasticsearch search result to Json Object. I havent found any proper way to convert directly.
SearchResponse response = client.prepareSearch(index).setExplain(true).execute().actionGet();
response->JSON Object.
Is there any way to convert an ElasticSearch response to a Json Object?
In Java, you can directly convert the SearchResponse to JSONObject. Below is the handy code.
SearchResponse SR = builder.setQuery(QB).addAggregation(AB).get();
JSONObject SRJSON = new JSONObject(SR.toString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With