Writes an Elasticsearch search response directly to the output stream as pretty-printed JSON. Created via ViewsBuilder.searchResponseView(...) from server-side JS, typically to return the raw result of a search query to a client. Accepts either a low-level Elasticsearch ToXContent or a Kademi KSearchResponse wrapper; if neither is set, render() writes an empty JSON object.

Group: Views

Implements: View, Serializable


Properties

PropertyReturnsDescription
contentTypeStringThe content type sent with the response, JsonResult's standard JSON content type.

Methods

render(CommonResource page, OutputStream out, Range range, Map<String,String> params, String contentType)

Returns: void

Writes the search response as JSON to the response output stream.

ParameterDescription
pagethe resource the view is being rendered for, not used by this view
outthe stream the JSON is written to
rangenot used by this view; the full response is always written
paramsrequest parameters, not used by this view
contentTypenot used by this view; getContentType() supplies the response content type

render(OutputStream out)

Returns: void

Writes the configured search response as pretty-printed JSON directly to the given stream, or an empty JSON object if this view has neither a ToXContent nor a KSearchResponse set.

ParameterDescription
outthe stream the JSON is written to

getContentType()

Returns: String

The content type sent with the response, JsonResult's standard JSON content type.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.