Package org.elasticsearch.action.update

Examples of org.elasticsearch.action.update.UpdateRequest


  }

  @Test
  public void to_string() {
    BulkRequestBuilder bulkRequestBuilder = searchClient.prepareBulk();
    bulkRequestBuilder.add(new UpdateRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1").doc(Collections.emptyMap()));
    bulkRequestBuilder.add(new DeleteRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1"));
    bulkRequestBuilder.add(new IndexRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1").source(Collections.emptyMap()));

    assertThat(bulkRequestBuilder.toString()).contains("ES bulk request for [Action 'UpdateRequest' for key 'rule1' on index 'rules' on type 'rules'],")
      .contains("[Action 'DeleteRequest' for key 'rule1' on index 'rules' on type 'rules'],")
View Full Code Here


  public void with_profiling_basic() {
    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
    SearchClient searchClient = new SearchClient(new Settings(), profiling);

    BulkRequestBuilder bulkRequestBuilder = searchClient.prepareBulk();
    bulkRequestBuilder.add(new UpdateRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1").doc(Collections.emptyMap()));
    bulkRequestBuilder.add(new DeleteRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1"));
    bulkRequestBuilder.add(new IndexRequest(IndexDefinition.RULE.getIndexName(), IndexDefinition.RULE.getIndexName(), "rule1").source(Collections.emptyMap()));
    try {
      bulkRequestBuilder.get();
View Full Code Here

          parentKey = parentDto.getKey().toString();
        }
      }

      /* Creating updateRequest */
      requests.add(new UpdateRequest()
        .replicationType(ReplicationType.ASYNC)
        .routing(key.ruleKey().toString())
        .id(activeRuleDto.getKey().toString())
        .parent(activeRuleDto.getKey().ruleKey().toString())
        .doc(newRule)
View Full Code Here

    Map<String, Object> newParam = new HashMap<String, Object>();
    newParam.put(ActiveRuleParamField.NAME.field(), param.getKey());
    newParam.put(ActiveRuleParamField.VALUE.field(), param.getValue());

    return ImmutableList.of(new UpdateRequest()
      .replicationType(ReplicationType.ASYNC)
      .routing(key.ruleKey().toString())
      .id(key.toString())
      .script(ProcessConstants.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_FIELD, ActiveRuleField.PARAMS.field())
View Full Code Here

      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_ID_VALUE, param.getKey())
      );
  }

  private List<UpdateRequest> nestedDelete(ActiveRuleParamDto param, ActiveRuleKey key) {
    return ImmutableList.of(new UpdateRequest()
      .replicationType(ReplicationType.ASYNC)
      .routing(key.ruleKey().toString())
      .id(key.toString())
      .script(ProcessConstants.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_FIELD, ActiveRuleField.PARAMS.field())
View Full Code Here

  @Override
  public void addToBulk(BulkRequestBuilder bulk, String indexName, OperationContext context) {
    Object entity = getEntity();
    if (entity != null) {
      UpdateRequest update = updateRequest(entity);

      if (update != null) {
        bulk.add(update);
      }
    }
View Full Code Here

                        addSource(entity, values, entityType);

                        addRelations(relationHolders, values);

                        UpdateRequest request = new UpdateRequest(metadata.getSchema().toLowerCase(),
                                metadata.getTableName(), key).doc(values);
                        bulkRequest.add(request);
                    }
                    else
                    {
View Full Code Here

    }

    public UpdateRequest getApiUpdateByIdRequest(boolean queryPlannerEnabled) {
        Map<String, Integer> updateDoc = new HashMap<>();
        updateDoc.put("population", Math.abs(getRandom().nextInt()));
        return new UpdateRequest(INDEX_NAME, "default", queryPlannerEnabled ? updateIdqueryPlannerEnabled : updateId).doc(updateDoc);
    }
View Full Code Here

        Uid uid = Uid.createUid(((ScriptDocValues.Strings) lookup.doc().get("_uid")).getValue());
        collect(uid);
    }

    private void collect(Uid uid) {
        UpdateRequest request = new CollectorUpdateRequest(shardId, uid);
        updateAction.execute(request).actionGet();
        rowCount++;
    }
View Full Code Here

    public void start() {
        transport.execute(this.request, this.listener);
    }

    protected UpdateRequest buildUpdateRequest(ESUpdateNode node) {
        UpdateRequest request = new UpdateRequest(node.indices()[0],
                Constants.DEFAULT_MAPPING_TYPE, node.ids().get(0));
        request.fields(node.columns());
        request.paths(node.updateDoc());
        if (node.version().isPresent()) {
            request.version(node.version().get());
        } else {
            request.retryOnConflict(Constants.UPDATE_RETRY_ON_CONFLICT);
        }
        request.routing(node.routingValues().get(0));
        return request;
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.update.UpdateRequest

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.