Package org.elasticsearch.common.xcontent

Examples of org.elasticsearch.common.xcontent.XContentBuilder.startObject()


        flushRequest.full(request.paramAsBoolean("full", flushRequest.full()));
        client.admin().indices().flush(flushRequest, new ActionListener<FlushResponse>() {
            @Override public void onResponse(FlushResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    builder.startObject();
                    builder.field("ok", true);

                    buildBroadcastShardsHeader(builder, response);

                    builder.endObject();
View Full Code Here


                        for (ShardRouting shardRouting : state.readOnlyRoutingNodes().unassigned()) {
                            jsonShardRouting(builder, shardRouting);
                        }
                        builder.endArray();

                        builder.startObject("nodes");
                        for (RoutingNode routingNode : state.readOnlyRoutingNodes()) {
                            builder.startArray(routingNode.nodeId(), XContentBuilder.FieldCaseConversion.NONE);
                            for (ShardRouting shardRouting : routingNode) {
                                jsonShardRouting(builder, shardRouting);
                            }
View Full Code Here

                    }

                    if (!clusterStateRequest.filterRoutingTable()) {
                        builder.startArray("allocations");
                        for (Map.Entry<ShardId, List<AllocationExplanation.NodeExplanation>> entry : state.allocationExplanation().explanations().entrySet()) {
                            builder.startObject();
                            builder.field("index", entry.getKey().index().name());
                            builder.field("shard", entry.getKey().id());
                            builder.startArray("explanations");
                            for (AllocationExplanation.NodeExplanation nodeExplanation : entry.getValue()) {
                                builder.field("desc", nodeExplanation.description());
View Full Code Here

                            builder.field("shard", entry.getKey().id());
                            builder.startArray("explanations");
                            for (AllocationExplanation.NodeExplanation nodeExplanation : entry.getValue()) {
                                builder.field("desc", nodeExplanation.description());
                                if (nodeExplanation.node() != null) {
                                    builder.startObject("node");
                                    builder.field("id", nodeExplanation.node().id());
                                    builder.field("name", nodeExplanation.node().name());
                                    builder.endObject();
                                }
                            }
View Full Code Here

                    onFailure(e);
                }
            }

            private void jsonShardRouting(XContentBuilder builder, ShardRouting shardRouting) throws IOException {
                builder.startObject()
                        .field("state", shardRouting.state())
                        .field("primary", shardRouting.primary())
                        .field("node", shardRouting.currentNodeId())
                        .field("relocating_node", shardRouting.relocatingNodeId())
                        .field("shard", shardRouting.shardId().id())
View Full Code Here

        closeIndexRequest.timeout(request.paramAsTime("timeout", timeValueSeconds(10)));
        client.admin().indices().close(closeIndexRequest, new ActionListener<CloseIndexResponse>() {
            @Override public void onResponse(CloseIndexResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    builder.startObject()
                            .field(Fields.OK, true)
                            .field(Fields.ACKNOWLEDGED, response.acknowledged())
                            .endObject();
                    channel.sendResponse(new XContentRestResponse(request, OK, builder));
                } catch (IOException e) {
View Full Code Here

        gatewaySnapshotRequest.listenerThreaded(false);
        client.admin().indices().gatewaySnapshot(gatewaySnapshotRequest, new ActionListener<GatewaySnapshotResponse>() {
            @Override public void onResponse(GatewaySnapshotResponse response) {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    builder.startObject();
                    builder.field("ok", true);

                    buildBroadcastShardsHeader(builder, response);

                    builder.endObject();
View Full Code Here

        nodesRestartRequest.delay(request.paramAsTime("delay", nodesRestartRequest.delay()));
        client.admin().cluster().nodesRestart(nodesRestartRequest, new ActionListener<NodesRestartResponse>() {
            @Override public void onResponse(NodesRestartResponse result) {
                try {
                    XContentBuilder builder = restContentBuilder(request);
                    builder.startObject();
                    builder.field("cluster_name", result.clusterName().value());

                    builder.startObject("nodes");
                    for (NodesRestartResponse.NodeRestartResponse nodeInfo : result) {
                        builder.startObject(nodeInfo.node().id());
View Full Code Here

                try {
                    XContentBuilder builder = restContentBuilder(request);
                    builder.startObject();
                    builder.field("cluster_name", result.clusterName().value());

                    builder.startObject("nodes");
                    for (NodesRestartResponse.NodeRestartResponse nodeInfo : result) {
                        builder.startObject(nodeInfo.node().id());
                        builder.field("name", nodeInfo.node().name());
                        builder.endObject();
                    }
View Full Code Here

                    builder.startObject();
                    builder.field("cluster_name", result.clusterName().value());

                    builder.startObject("nodes");
                    for (NodesRestartResponse.NodeRestartResponse nodeInfo : result) {
                        builder.startObject(nodeInfo.node().id());
                        builder.field("name", nodeInfo.node().name());
                        builder.endObject();
                    }
                    builder.endObject();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.