Class RestActions


  • public class RestActions
    extends java.lang.Object
    • Field Detail

      • _SHARDS_FIELD

        public static final ParseField _SHARDS_FIELD
      • TOTAL_FIELD

        public static final ParseField TOTAL_FIELD
      • SUCCESSFUL_FIELD

        public static final ParseField SUCCESSFUL_FIELD
      • SKIPPED_FIELD

        public static final ParseField SKIPPED_FIELD
      • FAILED_FIELD

        public static final ParseField FAILED_FIELD
      • FAILURES_FIELD

        public static final ParseField FAILURES_FIELD
    • Constructor Detail

      • RestActions

        public RestActions()
    • Method Detail

      • parseVersion

        public static long parseVersion​(RestRequest request)
      • parseVersion

        public static long parseVersion​(RestRequest request,
                                        long defaultVersion)
      • buildNodesHeader

        public static void buildNodesHeader​(XContentBuilder builder,
                                            ToXContent.Params params,
                                            int total,
                                            int successful,
                                            int failed,
                                            java.util.List<FailedNodeException> failures)
                                     throws java.io.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:
        java.io.IOException
        See Also:
        buildNodesHeader(XContentBuilder, Params, BaseNodesResponse)
      • nodesResponse

        public static <NodesResponse extends BaseNodesResponse & ToXContentBytesRestResponse nodesResponse​(XContentBuilder builder,
                                                                                                             ToXContent.Params params,
                                                                                                             NodesResponse response)
                                                                                                      throws java.io.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:
        java.io.IOException - if building the response causes an issue