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
| Property | Returns | Description |
|---|---|---|
| contentType | String | The 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.
| Parameter | Description |
|---|---|
page | the resource the view is being rendered for, not used by this view |
out | the stream the JSON is written to |
range | not used by this view; the full response is always written |
params | request parameters, not used by this view |
contentType | not 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.
| Parameter | Description |
|---|---|
out | the stream the JSON is written to |
getContentType()
Returns: String
The content type sent with the response, JsonResult's standard JSON content type.