Examples of opType()


Examples of org.elasticsearch.action.index.IndexRequest.opType()

        // indexRequest.version(RestActions.parseVersion(request));
        // indexRequest.versionType(VersionType.fromString(request.param("version_type"),
        // indexRequest.versionType()));

        indexRequest.percolate(request.param("percolate", null));
        indexRequest.opType(IndexRequest.OpType.INDEX);

        // TODO: force creation of index, do we need it?
        // indexRequest.create(true);

        String replicationType = request.param("replication");
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                    SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id())
                            .routing(indexRequest.routing()).parent(indexRequest.parent());
                    long version;
                    Engine.IndexingOperation op;
                    if (indexRequest.opType() == IndexRequest.OpType.INDEX) {
                        Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.version()).versionType(indexRequest.versionType()).origin(Engine.Operation.Origin.PRIMARY);
                        indexShard.index(index);
                        version = index.version();
                        op = index;
                    } else {
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                        }
                        ops[i] = op;
                    }

                    // add the response
                    responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
                            new IndexResponse(indexRequest.index(), indexRequest.type(), indexRequest.id(), version));
                } catch (Exception e) {
                    logger.debug("[{}][{}] failed to bulk item (index) {}", e, shardRequest.request.index(), shardRequest.shardId, indexRequest);
                    responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
                            new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), ExceptionsHelper.detailedMessage(e)));
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                    // add the response
                    responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
                            new IndexResponse(indexRequest.index(), indexRequest.type(), indexRequest.id(), version));
                } catch (Exception e) {
                    logger.debug("[{}][{}] failed to bulk item (index) {}", e, shardRequest.request.index(), shardRequest.shardId, indexRequest);
                    responses[i] = new BulkItemResponse(item.id(), indexRequest.opType().toString().toLowerCase(),
                            new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), ExceptionsHelper.detailedMessage(e)));
                }
            } else if (item.request() instanceof DeleteRequest) {
                DeleteRequest deleteRequest = (DeleteRequest) item.request();
                try {
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

            if (item.request() instanceof IndexRequest) {
                IndexRequest indexRequest = (IndexRequest) item.request();
                try {
                    SourceToParse sourceToParse = SourceToParse.source(indexRequest.source()).type(indexRequest.type()).id(indexRequest.id())
                            .routing(indexRequest.routing()).parent(indexRequest.parent());
                    if (indexRequest.opType() == IndexRequest.OpType.INDEX) {
                        Engine.Index index = indexShard.prepareIndex(sourceToParse).version(indexRequest.version()).origin(Engine.Operation.Origin.REPLICA);
                        indexShard.index(index);
                    } else {
                        Engine.Create create = indexShard.prepareCreate(sourceToParse).version(indexRequest.version()).origin(Engine.Operation.Origin.REPLICA);
                        indexShard.create(create);
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                indexRequest.index(clusterState.metaData().concreteIndex(indexRequest.index()));
                if (allowIdGeneration) {
                    if (indexRequest.id() == null) {
                        indexRequest.id(UUID.randomBase64UUID());
                        // since we generate the id, change it to CREATE
                        indexRequest.opType(IndexRequest.OpType.CREATE);
                    }
                }
            } else if (request instanceof DeleteRequest) {
                DeleteRequest deleteRequest = (DeleteRequest) request;
                deleteRequest.index(clusterState.metaData().concreteIndex(deleteRequest.index()));
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                MappingMetaData mappingMd = clusterState.metaData().index(indexRequest.index()).mapping(indexRequest.type());
                if (mappingMd != null) {
                    try {
                        indexRequest.processRouting(mappingMd);
                    } catch (ElasticSearchException e) {
                        responses[i] = new BulkItemResponse(i, indexRequest.opType().toString().toLowerCase(),
                                new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), e.getDetailedMessage()));
                        continue;
                    }
                }
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

                    String message = ExceptionsHelper.detailedMessage(e);
                    synchronized (responses) {
                        for (BulkItemRequest request : requests) {
                            if (request.request() instanceof IndexRequest) {
                                IndexRequest indexRequest = (IndexRequest) request.request();
                                responses[request.id()] = new BulkItemResponse(request.id(), indexRequest.opType().toString().toLowerCase(),
                                        new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), message));
                            } else if (request.request() instanceof DeleteRequest) {
                                DeleteRequest deleteRequest = (DeleteRequest) request.request();
                                responses[request.id()] = new BulkItemResponse(request.id(), "delete",
                                        new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), message));
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

        indexRequest.versionType(VersionType.fromString(request.param("version_type"), indexRequest.versionType()));
        indexRequest.percolate(request.param("percolate", null));
        String sOpType = request.param("op_type");
        if (sOpType != null) {
            if ("index".equals(sOpType)) {
                indexRequest.opType(IndexRequest.OpType.INDEX);
            } else if ("create".equals(sOpType)) {
                indexRequest.opType(IndexRequest.OpType.CREATE);
            } else {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
View Full Code Here

Examples of org.elasticsearch.action.index.IndexRequest.opType()

        String sOpType = request.param("op_type");
        if (sOpType != null) {
            if ("index".equals(sOpType)) {
                indexRequest.opType(IndexRequest.OpType.INDEX);
            } else if ("create".equals(sOpType)) {
                indexRequest.opType(IndexRequest.OpType.CREATE);
            } else {
                try {
                    XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);
                    channel.sendResponse(new XContentRestResponse(request, BAD_REQUEST, builder.startObject().field("error", "opType [" + sOpType + "] not allowed, either [index] or [create] are allowed").endObject()));
                } catch (IOException e1) {
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.