Examples of opType()


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

      ir.type(_sIndexType);
      if (null != sParentId) {
        ir.parent(sParentId);
      }
      if (!bAllowOverwrite) {
        ir.opType(OpType.CREATE);
      }//TESTED
     
      // Some _id unpleasantness
      if (null != idFieldName) {
       
View Full Code Here

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

      ir.type(_sIndexType);
      if (null != sParentId) {
        ir.parent(sParentId);
      }
      if (!bAllowOverwrite) {
        ir.opType(OpType.CREATE);
      }//TESTED
     
      // Some _id unpleasantness
      if (null != idFieldName) {
       
View Full Code Here

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()

                    } catch (ObjectImportException e) {
                        bulkListener.addFailure();
                        continue;
                    }
                    if (indexRequest != null) {
                        indexRequest.opType(OpType.INDEX);
                        if (index != null) {
                            indexRequest.index(index);
                        }
                        if (type != null) {
                            indexRequest.type(type);
View Full Code Here

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

        indexRequest.version(RestActions.parseVersion(request));
        indexRequest.versionType(VersionType.fromString(request.param("version_type"), indexRequest.versionType()));
        String sOpType = request.param("op_type");
        if (sOpType != null) {
            try {
                indexRequest.opType(IndexRequest.OpType.fromString(sOpType));
            } catch (ElasticsearchIllegalArgumentException eia){
                try {
                    XContentBuilder builder = channel.newBuilder();
                    channel.sendResponse(new BytesRestResponse(BAD_REQUEST, builder.startObject().field("error", eia.getMessage()).endObject()));
                } catch (IOException e1) {
View Full Code Here

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

                try {
                    try {
                        WriteResult result = shardIndexOperation(request, indexRequest, clusterState, indexShard, true);
                        // add the response
                        IndexResponse indexResponse = result.response();
                        setResponse(item, new BulkItemResponse(item.id(), indexRequest.opType().lowercase(), indexResponse));
                        if (result.mappingTypeToUpdate != null) {
                            mappingTypesToUpdate.add(result.mappingTypeToUpdate);
                        }
                        if (result.op != null) {
                            if (ops == null) {
View Full Code Here

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

                    // again, due to primary relocation and only processing up to N bulk items when the shard gets closed)
                    // then just use the response we got from the successful execution
                    if (item.getPrimaryResponse() != null && isConflictException(e)) {
                        setResponse(item, item.getPrimaryResponse());
                    } else {
                        setResponse(item, new BulkItemResponse(item.id(), indexRequest.opType().lowercase(),
                                new BulkItemResponse.Failure(request.index(), indexRequest.type(), indexRequest.id(), e)));
                    }
                }
            } else if (item.request() instanceof DeleteRequest) {
                DeleteRequest deleteRequest = (DeleteRequest) item.request();
View Full Code Here

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

                IndexRequest indexRequest = (IndexRequest) item.request();
                try {
                    SourceToParse sourceToParse = SourceToParse.source(SourceToParse.Origin.REPLICA, indexRequest.source()).type(indexRequest.type()).id(indexRequest.id())
                            .routing(indexRequest.routing()).parent(indexRequest.parent()).timestamp(indexRequest.timestamp()).ttl(indexRequest.ttl());

                    if (indexRequest.opType() == IndexRequest.OpType.INDEX) {
                        Engine.Index index = indexShard.prepareIndex(sourceToParse, indexRequest.version(), indexRequest.versionType(), Engine.Operation.Origin.REPLICA, request.canHaveDuplicates() || indexRequest.canHaveDuplicates());
                        indexShard.index(index);
                    } else {
                        Engine.Create create = indexShard.prepareCreate(sourceToParse,
                                indexRequest.version(), indexRequest.versionType(),
View Full Code Here

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

                    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)));
                        } else if (request.request() instanceof DeleteRequest) {
                            DeleteRequest deleteRequest = (DeleteRequest) request.request();
                            responses.set(request.id(), new BulkItemResponse(request.id(), "delete",
                                    new BulkItemResponse.Failure(concreteIndices.getConcreteIndex(deleteRequest.index()), deleteRequest.type(), deleteRequest.id(), message, status)));
View Full Code Here

Examples of org.elasticsearch.action.indexedscripts.put.PutIndexedScriptRequest.opType()

        putRequest.versionType(VersionType.fromString(request.param("version_type"), putRequest.versionType()));
        putRequest.source(request.content(), request.contentUnsafe());
        String sOpType = request.param("op_type");
        if (sOpType != null) {
            try {
                putRequest.opType(IndexRequest.OpType.fromString(sOpType));
            } catch (ElasticsearchIllegalArgumentException eia){
                try {
                    XContentBuilder builder = channel.newBuilder();
                    channel.sendResponse(new BytesRestResponse(BAD_REQUEST, builder.startObject().field("error", eia.getMessage()).endObject()));
                    return;
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.