Class RestActions

java.lang.Object
org.elasticsearch.rest.action.RestActions

public class RestActions extends Object
  • Field Details

    • _SHARDS_FIELD

      public static final org.elasticsearch.xcontent.ParseField _SHARDS_FIELD
    • TOTAL_FIELD

      public static final org.elasticsearch.xcontent.ParseField TOTAL_FIELD
    • SUCCESSFUL_FIELD

      public static final org.elasticsearch.xcontent.ParseField SUCCESSFUL_FIELD
    • SKIPPED_FIELD

      public static final org.elasticsearch.xcontent.ParseField SKIPPED_FIELD
    • FAILED_FIELD

      public static final org.elasticsearch.xcontent.ParseField FAILED_FIELD
    • FAILURES_FIELD

      public static final org.elasticsearch.xcontent.ParseField FAILURES_FIELD
  • Constructor Details

    • RestActions

      public RestActions()
  • Method Details

    • parseVersion

      public static long parseVersion(RestRequest request)
    • parseVersion

      public static long parseVersion(RestRequest request, long defaultVersion)
    • buildBroadcastShardsHeader

      public static void buildBroadcastShardsHeader(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params, BroadcastResponse response) throws IOException
      Throws:
      IOException
    • buildBroadcastShardsHeader

      public static void buildBroadcastShardsHeader(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.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.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params, BaseNodesResponse<NodeResponse> response) throws IOException
      Create the XContent header for any BaseNodesResponse.
      Parameters:
      builder - XContent builder.
      params - XContent parameters.
      response - The response containing individual, node-level responses.
      Throws:
      IOException
      See Also:
    • buildNodesHeader

      public static void buildNodesHeader(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params, int total, int successful, int failed, List<FailedNodeException> failures) throws IOException
      Create the XContent header for any BaseNodesResponse. 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 (effectively total - successful).
      failures - The failure exceptions related to failed.
      Throws:
      IOException
      See Also:
    • nodesResponse

      public static <NodesResponse extends BaseNodesResponse & org.elasticsearch.xcontent.ToXContent> BytesRestResponse nodesResponse(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params, NodesResponse response) throws IOException
      Automatically transform the ToXContent-compatible, nodes-level response into a a BytesRestResponse.

      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

      public static QueryBuilder urlParamsToQueryBuilder(RestRequest request)
    • getQueryContent

      public static QueryBuilder getQueryContent(org.elasticsearch.xcontent.XContentParser requestParser)
    • getQueryContent

      public static QueryBuilder getQueryContent(String fieldName, org.elasticsearch.xcontent.XContentParser requestParser)