Package org.elasticsearch.action.update

Examples of org.elasticsearch.action.update.UpdateRequest


*/
@SuppressWarnings("unused")
public class UpdateRequestBuilder<JsonInput, JsonOutput> extends AbstractRequestBuilderJsonOutput<UpdateRequest, UpdateResponse, JsonInput, JsonOutput> {

    public UpdateRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
        super(client, new UpdateRequest(null, null, null), jsonToString, stringToJson);
    }
View Full Code Here


    updateQuery.setIndexName(indexName);
    updateQuery.setType(type);
    updateQuery.setClazz(clazz);
    if (this.indexRequest != null) {
      if (this.updateRequest == null) {
        updateRequest = new UpdateRequest();
      }
      updateRequest.doc(indexRequest);
    }
    updateQuery.setUpdateRequest(updateRequest);
    updateQuery.setDoUpsert(doUpsert);
View Full Code Here

    logDoc.put(LogFields.UPDATED_AT.field(), dto.getUpdatedAt());

    logDoc.put(LogFields.DETAILS.field(), KeyValueFormat.parse(dto.getData()));

    /* Creating updateRequest */
    return ImmutableList.of(new UpdateRequest()
      .id(dto.getKey())
      .replicationType(ReplicationType.ASYNC)
      .doc(logDoc)
      .upsert(logDoc));
  }
View Full Code Here

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

      /** Upsert elements */
      Map<String, Object> upsert = getUpsertFor(RuleField.ALL_FIELDS, update);
      upsert.put(RuleField.KEY.field(), rule.getKey().toString());

      /** Creating updateRequest */
      requests.add(new UpdateRequest()
        .id(rule.getKey().toString())
        .doc(update)
        .upsert(upsert));

      for (RuleParamDto param : db.ruleDao().findRuleParamsByRuleKey(session, rule.getKey())) {
View Full Code Here

    newParam.put(RuleParamField.NAME.field(), param.getName());
    newParam.put(RuleParamField.TYPE.field(), param.getType());
    newParam.put(RuleParamField.DESCRIPTION.field(), param.getDescription());
    newParam.put(RuleParamField.DEFAULT_VALUE.field(), param.getDefaultValue());

    return ImmutableList.of(new UpdateRequest()
      .id(key.toString())
      .script(ProcessConstants.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_FIELD, RuleField.PARAMS.field())
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_VALUE, newParam)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_ID_FIELD, RuleParamField.NAME.field())
View Full Code Here

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

  private List<UpdateRequest> nestedDelete(RuleParamDto param, RuleKey key) {
    return ImmutableList.of(new UpdateRequest()
      .id(key.toString())
      .script(ProcessConstants.ES_PLUGIN_LISTUPDATE_SCRIPT_NAME)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_FIELD, RuleField.PARAMS.field())
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_VALUE, null)
      .addScriptParam(ProcessConstants.ES_PLUGIN_LISTUPDATE_ID_FIELD, RuleParamField.NAME.field())
View Full Code Here

    /** Upsert elements */
    Map<String, Object> upsert = getUpsertFor(IssueField.ALL_FIELDS, update);
    upsert.put(IssueField.KEY.field(), dto.getKey());

    return ImmutableList.of(
      new UpdateRequest()
        .id(dto.getKey())
        .routing(dto.getProjectUuid())
        .parent(dto.getProjectUuid())
        .doc(update)
        .upsert(upsert));
View Full Code Here

    /** Upsert elements */
    Map<String, Object> upsert = getUpsertFor(IssueAuthorizationField.ALL_FIELDS, update);
    upsert.put(IssueAuthorizationField.PROJECT.field(), dto.getKey());

    return ImmutableList.of(
      new UpdateRequest()
        .id(dto.getKey())
        .doc(update)
        .upsert(upsert));
  }
View Full Code Here

  SearchClient searchClient = new SearchClient(new Settings(), profiling);

  @Test
  public void bulk() {
    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

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.