当前位置: 首页>>代码示例>>Java>>正文


Java UpdateAction类代码示例

本文整理汇总了Java中org.elasticsearch.action.update.UpdateAction的典型用法代码示例。如果您正苦于以下问题:Java UpdateAction类的具体用法?Java UpdateAction怎么用?Java UpdateAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UpdateAction类属于org.elasticsearch.action.update包,在下文中一共展示了UpdateAction类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUpdate

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
public void testUpdate() {
    //update action goes to the primary, index op gets executed locally, then replicated
    String[] updateShardActions = new String[]{UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
    interceptTransportActions(updateShardActions);

    String indexOrAlias = randomIndexOrAlias();
    client().prepareIndex(indexOrAlias, "type", "id").setSource("field", "value").get();
    UpdateRequest updateRequest = new UpdateRequest(indexOrAlias, "type", "id").doc(Requests.INDEX_CONTENT_TYPE, "field1", "value1");
    UpdateResponse updateResponse = internalCluster().coordOnlyNodeClient().update(updateRequest).actionGet();
    assertEquals(DocWriteResponse.Result.UPDATED, updateResponse.getResult());

    clearInterceptedActions();
    assertSameIndices(updateRequest, updateShardActions);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:IndicesRequestIT.java

示例2: testUpdateUpsert

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
public void testUpdateUpsert() {
    //update action goes to the primary, index op gets executed locally, then replicated
    String[] updateShardActions = new String[]{UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
    interceptTransportActions(updateShardActions);

    String indexOrAlias = randomIndexOrAlias();
    UpdateRequest updateRequest = new UpdateRequest(indexOrAlias, "type", "id").upsert(Requests.INDEX_CONTENT_TYPE, "field", "value")
        .doc(Requests.INDEX_CONTENT_TYPE, "field1", "value1");
    UpdateResponse updateResponse = internalCluster().coordOnlyNodeClient().update(updateRequest).actionGet();
    assertEquals(DocWriteResponse.Result.CREATED, updateResponse.getResult());

    clearInterceptedActions();
    assertSameIndices(updateRequest, updateShardActions);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:IndicesRequestIT.java

示例3: testUpdateDelete

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
public void testUpdateDelete() {
    //update action goes to the primary, delete op gets executed locally, then replicated
    String[] updateShardActions = new String[]{UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
    interceptTransportActions(updateShardActions);

    String indexOrAlias = randomIndexOrAlias();
    client().prepareIndex(indexOrAlias, "type", "id").setSource("field", "value").get();
    UpdateRequest updateRequest = new UpdateRequest(indexOrAlias, "type", "id")
            .script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "ctx.op='delete'", Collections.emptyMap()));
    UpdateResponse updateResponse = internalCluster().coordOnlyNodeClient().update(updateRequest).actionGet();
    assertEquals(DocWriteResponse.Result.DELETED, updateResponse.getResult());

    clearInterceptedActions();
    assertSameIndices(updateRequest, updateShardActions);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:IndicesRequestIT.java

示例4: update

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
@Override
public ActionFuture<UpdateResponse> update(final UpdateRequest request) {
    return execute(UpdateAction.INSTANCE, request);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例5: prepareUpdate

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
@Override
public UpdateRequestBuilder prepareUpdate() {
    return new UpdateRequestBuilder(this, UpdateAction.INSTANCE, null, null, null);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例6: getAction

import org.elasticsearch.action.update.UpdateAction; //导入依赖的package包/类
public UpdateAction getAction() {
    return UpdateAction.INSTANCE;
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:4,代码来源:UpdateActionHandler.java


注:本文中的org.elasticsearch.action.update.UpdateAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。