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


Java BulkAction.NAME属性代码示例

本文整理汇总了Java中org.elasticsearch.action.bulk.BulkAction.NAME属性的典型用法代码示例。如果您正苦于以下问题:Java BulkAction.NAME属性的具体用法?Java BulkAction.NAME怎么用?Java BulkAction.NAME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.elasticsearch.action.bulk.BulkAction的用法示例。


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

示例1: testIndex

public void testIndex() {
    String[] indexShardActions = new String[]{BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
    interceptTransportActions(indexShardActions);

    IndexRequest indexRequest = new IndexRequest(randomIndexOrAlias(), "type", "id")
        .source(Requests.INDEX_CONTENT_TYPE, "field", "value");
    internalCluster().coordOnlyNodeClient().index(indexRequest).actionGet();

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

示例2: testDelete

public void testDelete() {
    String[] deleteShardActions = new String[]{BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]"};
    interceptTransportActions(deleteShardActions);

    DeleteRequest deleteRequest = new DeleteRequest(randomIndexOrAlias(), "type", "id");
    internalCluster().coordOnlyNodeClient().delete(deleteRequest).actionGet();

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

示例3: testUpdate

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,代码行数:14,代码来源:IndicesRequestIT.java

示例4: testUpdateUpsert

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,代码行数:14,代码来源:IndicesRequestIT.java

示例5: testUpdateDelete

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,代码行数:15,代码来源:IndicesRequestIT.java


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