Package org.elasticsearch.action.index

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


    BulkRequestBuilder brb = _elasticClient.prepareBulk();
   
    JsonArray docJsonArray = docsJson.getAsJsonArray();
    for (JsonElement docJson: docJsonArray) {
      IndexRequest ir = new IndexRequest(_sIndexName);
      ir.type(_sIndexType);
      if (null != sParentId) {
        ir.parent(sParentId);
      }
      if (!bAllowOverwrite) {
        ir.opType(OpType.CREATE);
View Full Code Here


    }
    BulkRequestBuilder brb = _elasticClient.prepareBulk();
   
    for (DBObject docJson: docsJson) {
      IndexRequest ir = new IndexRequest(_sIndexName);
      ir.type(_sIndexType);
      if (null != sParentId) {
        ir.parent(sParentId);
      }
      if (!bAllowOverwrite) {
        ir.opType(OpType.CREATE);
View Full Code Here

                            }
                        }

                        builder.endObject();
                       
                        indexRequest.type(typeName).source(builder);
                        bulkRequest.add(indexRequest);
                        count++;
                       
                        if((count % bulkSize) == 0){
                            BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
View Full Code Here

      message.append(String.format("[Action '%s' ", item.getClass().getSimpleName()));
      if (item instanceof IndexRequest) {
        IndexRequest request = (IndexRequest) item;
        message.append(String.format("for key '%s'", request.id()));
        message.append(String.format(" on index '%s'", request.index()));
        message.append(String.format(" on type '%s'", request.type()));
      } else if (item instanceof UpdateRequest) {
        UpdateRequest request = (UpdateRequest) item;
        message.append(String.format("for key '%s'", request.id()));
        message.append(String.format(" on index '%s'", request.index()));
        message.append(String.format(" on type '%s'", request.type()));
View Full Code Here

        message.append(String.format(" on type '%s'", request.type()));
      } else if (item instanceof UpdateRequest) {
        UpdateRequest request = (UpdateRequest) item;
        message.append(String.format("for key '%s'", request.id()));
        message.append(String.format(" on index '%s'", request.index()));
        message.append(String.format(" on type '%s'", request.type()));
      } else if (item instanceof DeleteRequest) {
        DeleteRequest request = (DeleteRequest) item;
        message.append(String.format("for key '%s'", request.id()));
        message.append(String.format(" on index '%s'", request.index()));
        message.append(String.format(" on type '%s'", request.type()));
View Full Code Here

        message.append(String.format(" on type '%s'", request.type()));
      } else if (item instanceof DeleteRequest) {
        DeleteRequest request = (DeleteRequest) item;
        message.append(String.format("for key '%s'", request.id()));
        message.append(String.format(" on index '%s'", request.index()));
        message.append(String.format(" on type '%s'", request.type()));
      }
      message.append("],");
    }
    return message.toString();
  }
View Full Code Here

                        indexRequest.opType(OpType.INDEX);
                        if (index != null) {
                            indexRequest.index(index);
                        }
                        if (type != null) {
                            indexRequest.type(type);
                        }
                        if (indexRequest.type() != null && indexRequest.index() != null) {
                            bulkProcessor.add(indexRequest);
                        } else {
                            bulkListener.addFailure();
View Full Code Here

                            indexRequest.index(index);
                        }
                        if (type != null) {
                            indexRequest.type(type);
                        }
                        if (indexRequest.type() != null && indexRequest.index() != null) {
                            bulkProcessor.add(indexRequest);
                        } else {
                            bulkListener.addFailure();
                        }
                    } else {
View Full Code Here

                    if (fieldName.equals(IdFieldMapper.NAME) && token == Token.VALUE_STRING) {
                        indexRequest.id(parser.text());
                    } else if (fieldName.equals(IndexFieldMapper.NAME) && token == Token.VALUE_STRING) {
                        indexRequest.index(parser.text());
                    } else if (fieldName.equals(TypeFieldMapper.NAME) && token == Token.VALUE_STRING) {
                        indexRequest.type(parser.text());
                    } else if (fieldName.equals(RoutingFieldMapper.NAME) && token == Token.VALUE_STRING) {
                        indexRequest.routing(parser.text());
                    } else if (fieldName.equals(TimestampFieldMapper.NAME) && token == Token.VALUE_NUMBER) {
                        indexRequest.timestamp(String.valueOf(parser.longValue()));
                    } else if (fieldName.equals(TTLFieldMapper.NAME) && token == Token.VALUE_NUMBER) {
View Full Code Here

                    // 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();
                preVersions[requestIndex] = deleteRequest.version();
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.