Package org.elasticsearch.rest.action
Class RestActions
java.lang.Object
org.elasticsearch.rest.action.RestActions
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
RestActions.NodesResponseRestListener<NodesResponse extends BaseNodesResponse & org.elasticsearch.common.xcontent.ToXContent>
NodesResponseRestBuilderListener
automatically translates anyBaseNodesResponse
(multi-node) response that isToXContent
-compatible into aRestResponse
with the necessary header info (e.g., "cluster_name"). -
Field Summary
Modifier and TypeFieldDescriptionstatic org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
static org.elasticsearch.common.xcontent.ParseField
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
buildBroadcastShardsHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, int total, int successful, int skipped, int failed, ShardOperationFailedException[] shardFailures)
static void
buildBroadcastShardsHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, BroadcastResponse response)
static void
buildNodesHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, int total, int successful, int failed, List<FailedNodeException> failures)
Create the XContent header for anyBaseNodesResponse
.static <NodeResponse extends BaseNodeResponse>
voidbuildNodesHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, BaseNodesResponse<NodeResponse> response)
Create the XContent header for anyBaseNodesResponse
.static QueryBuilder
getQueryContent(String fieldName, org.elasticsearch.common.xcontent.XContentParser requestParser)
static QueryBuilder
getQueryContent(org.elasticsearch.common.xcontent.XContentParser requestParser)
static <NodesResponse extends BaseNodesResponse & org.elasticsearch.common.xcontent.ToXContent>
BytesRestResponsenodesResponse(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, NodesResponse response)
static long
parseVersion(RestRequest request)
static long
parseVersion(RestRequest request, long defaultVersion)
static QueryBuilder
urlParamsToQueryBuilder(RestRequest request)
-
Field Details
-
_SHARDS_FIELD
public static final org.elasticsearch.common.xcontent.ParseField _SHARDS_FIELD -
TOTAL_FIELD
public static final org.elasticsearch.common.xcontent.ParseField TOTAL_FIELD -
SUCCESSFUL_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SUCCESSFUL_FIELD -
SKIPPED_FIELD
public static final org.elasticsearch.common.xcontent.ParseField SKIPPED_FIELD -
FAILED_FIELD
public static final org.elasticsearch.common.xcontent.ParseField FAILED_FIELD -
FAILURES_FIELD
public static final org.elasticsearch.common.xcontent.ParseField FAILURES_FIELD
-
-
Constructor Details
-
RestActions
public RestActions()
-
-
Method Details
-
parseVersion
-
parseVersion
-
buildBroadcastShardsHeader
public static void buildBroadcastShardsHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, BroadcastResponse response) throws IOException- Throws:
IOException
-
buildBroadcastShardsHeader
public static void buildBroadcastShardsHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, int total, int successful, int skipped, int failed, ShardOperationFailedException[] shardFailures) throws IOException- Throws:
IOException
-
buildNodesHeader
public static <NodeResponse extends BaseNodeResponse> void buildNodesHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, BaseNodesResponse<NodeResponse> response) throws IOExceptionCreate the XContent header for anyBaseNodesResponse
.- Parameters:
builder
- XContent builder.params
- XContent parameters.response
- The response containing individual, node-level responses.- Throws:
IOException
- See Also:
buildNodesHeader(XContentBuilder, Params, int, int, int, List)
-
buildNodesHeader
public static void buildNodesHeader(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, int total, int successful, int failed, List<FailedNodeException> failures) throws 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:
IOException
- See Also:
buildNodesHeader(XContentBuilder, Params, BaseNodesResponse)
-
nodesResponse
public static <NodesResponse extends BaseNodesResponse & org.elasticsearch.common.xcontent.ToXContent> BytesRestResponse nodesResponse(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params, NodesResponse response) throws IOExceptionAutomatically transform theToXContent
-compatible, nodes-levelresponse
into 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:
IOException
- if building the response causes an issue
-
urlParamsToQueryBuilder
-
getQueryContent
public static QueryBuilder getQueryContent(org.elasticsearch.common.xcontent.XContentParser requestParser) -
getQueryContent
public static QueryBuilder getQueryContent(String fieldName, org.elasticsearch.common.xcontent.XContentParser requestParser)
-