Package org.elasticsearch.rest.action
Class RestActions
java.lang.Object
org.elasticsearch.rest.action.RestActions
public class RestActions
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRestActions.NodesResponseRestListener<NodesResponse extends BaseNodesResponse & ToXContent>NodesResponseRestBuilderListenerautomatically translates anyBaseNodesResponse(multi-node) response that isToXContent-compatible into aRestResponsewith the necessary header info (e.g., "cluster_name"). -
Field Summary
Fields Modifier and Type Field Description static ParseField_SHARDS_FIELDstatic ParseFieldFAILED_FIELDstatic ParseFieldFAILURES_FIELDstatic ParseFieldSKIPPED_FIELDstatic ParseFieldSUCCESSFUL_FIELDstatic ParseFieldTOTAL_FIELD -
Constructor Summary
Constructors Constructor Description RestActions() -
Method Summary
Modifier and Type Method Description static voidbuildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int skipped, int failed, ShardOperationFailedException[] shardFailures)static voidbuildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, BroadcastResponse response)static voidbuildNodesHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int failed, java.util.List<FailedNodeException> failures)Create the XContent header for anyBaseNodesResponse.static <NodeResponse extends BaseNodeResponse>
voidbuildNodesHeader(XContentBuilder builder, ToXContent.Params params, BaseNodesResponse<NodeResponse> response)Create the XContent header for anyBaseNodesResponse.static QueryBuildergetQueryContent(XContentParser requestParser)static <NodesResponse extends BaseNodesResponse & ToXContent>
BytesRestResponsenodesResponse(XContentBuilder builder, ToXContent.Params params, NodesResponse response)static longparseVersion(RestRequest request)static longparseVersion(RestRequest request, long defaultVersion)static QueryBuilderurlParamsToQueryBuilder(RestRequest request)
-
Field Details
-
Constructor Details
-
RestActions
public RestActions()
-
-
Method Details
-
parseVersion
-
parseVersion
-
buildBroadcastShardsHeader
public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, BroadcastResponse response) throws java.io.IOException- Throws:
java.io.IOException
-
buildBroadcastShardsHeader
public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int skipped, int failed, ShardOperationFailedException[] shardFailures) throws java.io.IOException- Throws:
java.io.IOException
-
buildNodesHeader
public static <NodeResponse extends BaseNodeResponse> void buildNodesHeader(XContentBuilder builder, ToXContent.Params params, BaseNodesResponse<NodeResponse> response) throws java.io.IOExceptionCreate the XContent header for anyBaseNodesResponse.- Parameters:
builder- XContent builder.params- XContent parameters.response- The response containing individual, node-level responses.- Throws:
java.io.IOException- See Also:
buildNodesHeader(XContentBuilder, Params, int, int, int, List)
-
buildNodesHeader
public static void buildNodesHeader(XContentBuilder builder, ToXContent.Params params, int total, int successful, int failed, java.util.List<FailedNodeException> failures) throws java.io.IOExceptionCreate the XContent header for anyBaseNodesResponse. This looks like:"_nodes" : { "total" : 3, "successful" : 1, "failed" : 2, "failures" : [ { ... }, { ... } ] }Prefer the overload that properly invokes this method to calling this directly.- Parameters:
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 (effectivelytotal - successful).failures- The failure exceptions related tofailed.- Throws:
java.io.IOException- See Also:
buildNodesHeader(XContentBuilder, Params, BaseNodesResponse)
-
nodesResponse
public static <NodesResponse extends BaseNodesResponse & ToXContent> BytesRestResponse nodesResponse(XContentBuilder builder, ToXContent.Params params, NodesResponse response) throws java.io.IOExceptionAutomatically transform theToXContent-compatible, nodes-levelresponseinto a aBytesRestResponse.This looks like:
{ "_nodes" : { ... }, "cluster_name" : "...", ... }- Parameters:
builder- XContent builder.params- XContent parameters.response- The nodes-level (plural) response.- Returns:
- Never
null. - Throws:
java.io.IOException- if building the response causes an issue
-
urlParamsToQueryBuilder
-
getQueryContent
-