Package org.elasticsearch.rest

Examples of org.elasticsearch.rest.RestStatus


            }
            return RestStatus.OK;
        }
        // if total failure, bubble up the status code to the response level
        if (getSuccessfulShards() == 0 && getTotalShards() > 0) {
            RestStatus status = RestStatus.OK;
            for (ShardOperationFailedException shardFailure : getShardFailures()) {
                RestStatus shardStatus = shardFailure.status();
                if (shardStatus.getStatus() >= status.getStatus()) {
                    status = shardStatus;
                }
            }
            return status;
        }
View Full Code Here


        if (in.readBoolean()) {
            String fIndex = in.readSharedString();
            String fType = in.readSharedString();
            String fId = in.readOptionalString();
            String fMessage = in.readString();
            RestStatus status = RestStatus.readFrom(in);
            failure = new Failure(fIndex, fType, fId, fMessage, status);
        }
    }
View Full Code Here

    public RestStatus status() {
        if (shardFailures.length == 0) {
            // if no successful shards, it means no active shards, so just return SERVICE_UNAVAILABLE
            return RestStatus.SERVICE_UNAVAILABLE;
        }
        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

                @Override
                public void onFailure(Throwable e) {
                    // create failures for all relevant requests
                    String message = ExceptionsHelper.detailedMessage(e);
                    RestStatus status = ExceptionsHelper.status(e);
                    for (BulkItemRequest request : requests) {
                        if (request.request() instanceof IndexRequest) {
                            IndexRequest indexRequest = (IndexRequest) request.request();
                            responses.set(request.id(), new BulkItemResponse(request.id(), indexRequest.opType().toString().toLowerCase(Locale.ENGLISH),
                                    new BulkItemResponse.Failure(concreteIndices.getConcreteIndex(indexRequest.index()), indexRequest.type(), indexRequest.id(), message, status)));
View Full Code Here

            }
            return RestStatus.OK;
        }
        // if total failure, bubble up the status code to the response level
        if (successfulShards == 0 && totalShards > 0) {
            RestStatus status = RestStatus.OK;
            for (int i = 0; i < shardFailures.length; i++) {
                RestStatus shardStatus = shardFailures[i].status();
                if (shardStatus.getStatus() >= status.getStatus()) {
                    status = shardFailures[i].status();
                }
            }
            return status;
        }
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.