Package org.elasticsearch.rest

Examples of org.elasticsearch.rest.RestStatus


                            .field(Fields._INDEX, result.index())
                            .field(Fields._TYPE, result.type())
                            .field(Fields._ID, result.id())
                            .field(Fields._VERSION, result.version())
                            .endObject();
                    RestStatus status = OK;
                    if (result.notFound()) {
                        status = NOT_FOUND;
                    }
                    channel.sendResponse(new XContentRestResponse(request, status, builder));
                } catch (Exception e) {
View Full Code Here


                            builder.value(match);
                        }
                        builder.endArray();
                    }
                    builder.endObject();
                    RestStatus status = OK;
                    if (response.version() == 1) {
                        status = CREATED;
                    }
                    channel.sendResponse(new XContentRestResponse(request, status, builder));
                } catch (Exception e) {
View Full Code Here

    public RestStatus status() {
        if (shardFailures.length == 0) {
            return RestStatus.OK;
        }
        if (successfulShards == 0 && totalShards > 0) {
            RestStatus status = shardFailures[0].status();
            if (shardFailures.length > 1) {
                for (int i = 1; i < shardFailures.length; i++) {
                    if (shardFailures[i].status().getStatus() >= 500) {
                        status = shardFailures[i].status();
                    }
View Full Code Here

    public RestStatus status() {
        if (shardFailures.length == 0) {
            return RestStatus.OK;
        }
        if (successfulShards == 0 && totalShards > 0) {
            RestStatus status = shardFailures[0].status();
            if (shardFailures.length > 1) {
                for (int i = 1; i < shardFailures.length; i++) {
                    if (shardFailures[i].status().getStatus() >= 500) {
                        status = shardFailures[i].status();
                    }
View Full Code Here

            return (SQLActionException) e;
        }
        e = esToCrateException(e);

        int errorCode = 5000;
        RestStatus restStatus = RestStatus.INTERNAL_SERVER_ERROR;
        String message = e.getMessage();
        StringWriter stackTrace = new StringWriter();
        e.printStackTrace(new PrintWriter(stackTrace));

        if (e instanceof CrateException) {
View Full Code Here

    public IndexDeleteByQueryResponse getIndex(String index) {
        return indices.get(index);
    }

    public RestStatus status() {
        RestStatus status = RestStatus.OK;
        for (IndexDeleteByQueryResponse indexResponse : indices.values()) {
            if (indexResponse.getFailedShards() > 0) {
                RestStatus indexStatus = indexResponse.getFailures()[0].status();
                if (indexResponse.getFailures().length > 1) {
                    for (int i = 1; i < indexResponse.getFailures().length; i++) {
                        if (indexResponse.getFailures()[i].status().getStatus() >= 500) {
                            indexStatus = indexResponse.getFailures()[i].status();
                        }
                    }
                }
                if (status.getStatus() < indexStatus.getStatus()) {
                    status = indexStatus;
                }
            }
        }
        return status;
View Full Code Here

            return RestStatus.INTERNAL_SERVER_ERROR;
        }
        if (shardFailures.size() == 0) {
            return RestStatus.OK;
        }
        RestStatus status = RestStatus.OK;
        if (successfulShards == 0 && totalShards > 0) {
            for (SnapshotShardFailure shardFailure : shardFailures)
                if (shardFailure.status().getStatus() > status().getStatus()) {
                    status = shardFailure.status();
                }
View Full Code Here

        return sb.toString();
    }

    @Override
    public RestStatus status() {
        RestStatus status = null;
        for (ClusterBlock block : blocks) {
            if (status == null) {
                status = block.status();
            } else if (status.getStatus() < block.status().getStatus()) {
                status = block.status();
            }
        }
        return status;
    }
View Full Code Here

                builder.startObject()
                        .field(Fields._ID, response.getId())
                        .field(Fields._VERSION, response.getVersion())
                        .field(Fields.CREATED, response.isCreated());
                builder.endObject();
                RestStatus status = OK;
                if (response.isCreated()) {
                    status = CREATED;
                }
                return new BytesRestResponse(status, builder);
            }
View Full Code Here

                        .field(Fields._TYPE, response.getType())
                        .field(Fields._ID, response.getId())
                        .field(Fields._VERSION, response.getVersion())
                        .field(Fields.CREATED, response.isCreated());
                builder.endObject();
                RestStatus status = OK;
                if (response.isCreated()) {
                    status = CREATED;
                }
                return new BytesRestResponse(status, builder);
            }
View Full Code Here

TOP

Related Classes of org.elasticsearch.rest.RestStatus

Copyright © 2018 www.massapicom. 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.