public class RestActions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RestActions.NodesResponseRestListener<NodesResponse extends BaseNodesResponse & ToXContent>
NodesResponseRestBuilderListener automatically translates any BaseNodesResponse (multi-node) response that is
ToXContent -compatible into a RestResponse with the necessary header info (e.g., "cluster_name"). |
Modifier and Type | Field and Description |
---|---|
static ParseField |
_SHARDS_FIELD |
static ParseField |
FAILED_FIELD |
static ParseField |
FAILURES_FIELD |
static ParseField |
SKIPPED_FIELD |
static ParseField |
SUCCESSFUL_FIELD |
static ParseField |
TOTAL_FIELD |
Constructor and Description |
---|
RestActions() |
Modifier and Type | Method and Description |
---|---|
static void |
buildBroadcastShardsHeader(XContentBuilder builder,
ToXContent.Params params,
BroadcastResponse response) |
static void |
buildBroadcastShardsHeader(XContentBuilder builder,
ToXContent.Params params,
int total,
int successful,
int skipped,
int failed,
ShardOperationFailedException[] shardFailures) |
static <NodeResponse extends BaseNodeResponse> |
buildNodesHeader(XContentBuilder builder,
ToXContent.Params params,
BaseNodesResponse<NodeResponse> response)
Create the XContent header for any
BaseNodesResponse . |
static void |
buildNodesHeader(XContentBuilder builder,
ToXContent.Params params,
int total,
int successful,
int failed,
java.util.List<FailedNodeException> failures)
Create the XContent header for any
BaseNodesResponse . |
static QueryBuilder |
getQueryContent(XContentParser requestParser) |
static <NodesResponse extends BaseNodesResponse & ToXContent> |
nodesResponse(XContentBuilder builder,
ToXContent.Params params,
NodesResponse response)
|
static long |
parseVersion(RestRequest request) |
static long |
parseVersion(RestRequest request,
long defaultVersion) |
static QueryBuilder |
urlParamsToQueryBuilder(RestRequest request) |
public static final ParseField _SHARDS_FIELD
public static final ParseField TOTAL_FIELD
public static final ParseField SUCCESSFUL_FIELD
public static final ParseField SKIPPED_FIELD
public static final ParseField FAILED_FIELD
public static final ParseField FAILURES_FIELD
public static long parseVersion(RestRequest request)
public static long parseVersion(RestRequest request, long defaultVersion)
public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, BroadcastResponse response) throws java.io.IOException
java.io.IOException
public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int skipped, int failed, ShardOperationFailedException[] shardFailures) throws java.io.IOException
java.io.IOException
public static <NodeResponse extends BaseNodeResponse> void buildNodesHeader(XContentBuilder builder, ToXContent.Params params, BaseNodesResponse<NodeResponse> response) throws java.io.IOException
BaseNodesResponse
.builder
- XContent builder.params
- XContent parameters.response
- The response containing individual, node-level responses.java.io.IOException
#buildNodesHeader(XContentBuilder, Params, int, int, int, List)
public static void buildNodesHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int failed, java.util.List<FailedNodeException> failures) throws java.io.IOException
BaseNodesResponse
. This looks like:
"_nodes" : {
"total" : 3,
"successful" : 1,
"failed" : 2,
"failures" : [ { ... }, { ... } ]
}
Prefer the overload that properly invokes this method to calling this directly.builder
- XContent builder.params
- XContent parameters.total
- The total number of nodes touched.successful
- The successful number of responses received.failed
- The number of failures (effectively total - successful
).failures
- The failure exceptions related to failed
.java.io.IOException
#buildNodesHeader(XContentBuilder, Params, BaseNodesResponse)
public static <NodesResponse extends BaseNodesResponse & ToXContent> BytesRestResponse nodesResponse(XContentBuilder builder, ToXContent.Params params, NodesResponse response) throws java.io.IOException
ToXContent
-compatible, nodes-level response
into a a BytesRestResponse
.
This looks like:
{
"_nodes" : { ... },
"cluster_name" : "...",
...
}
builder
- XContent builder.params
- XContent parameters.response
- The nodes-level (plural) response.null
.java.io.IOException
- if building the response causes an issuepublic static QueryBuilder urlParamsToQueryBuilder(RestRequest request)
public static QueryBuilder getQueryContent(XContentParser requestParser)