Elasticseach Java High Level client

I need to convert String object to Json object in spring boot
i have coded like this but through error

public Map<String, Object> datesearch() throws IOException
		 SearchRequest searchRequest = new SearchRequest();
		 SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); 
		 SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);

		XContentBuilder builder = XContentFactory.jsonBuilder();
		searchResponse.toXContent(builder, ToXContent.EMPTY_PARAMS);
		JSONObject json = new JSONObject(builder.toString()); // error at this line
		 return json;

This is probably a question you need to ask to the JSONObject class author.
From which library this class is coming?

BTW you can just do searchResponse.toString() to get the JSON version of the response object.

yah i did that
I need another help?

instead of having Winlogbeat create daily indices We can create separate index for logs from different client(Different machine) to one elasticsearch server

How to do?

That's a non related question. Please open a new question in #beats:winlogbeat

okay Thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.