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


Java DeleteRequest.type方法代码示例

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


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

示例1: should_marshall_delete_request

import org.elasticsearch.action.delete.DeleteRequest; //导入方法依赖的package包/类
@Test
public void should_marshall_delete_request() throws Exception {
    DeleteRequest request = new DeleteRequest();
    request.index("the_index");
    request.type("the_type");
    request.id("the_id");
    Observable<byte[]> observable = BulkActionMarshaller.lazyConvertToBytes(Collections.<ActionRequest>singletonList(request));
    assertHasSize(observable, 2);

    byte[] bytes = takeNth(observable, 0);
    String actionAsString = new String(bytes);
    assertThat(actionAsString).isEqualTo("{\"delete\":{\"_index\":\"the_index\",\"_type\":\"the_type\",\"_id\":\"the_id\"}}");

    bytes = takeNth(observable, 1);
    assertThat(new String(bytes)).isEqualTo("\n");
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:17,代码来源:BulkActionMarshallerTest.java

示例2: buildRequest

import org.elasticsearch.action.delete.DeleteRequest; //导入方法依赖的package包/类
@Override
protected RequestWrapper<DeleteRequest> buildRequest(ScrollableHitSource.Hit doc) {
    DeleteRequest delete = new DeleteRequest();
    delete.index(doc.getIndex());
    delete.type(doc.getType());
    delete.id(doc.getId());
    delete.version(doc.getVersion());
    return wrap(delete);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:AsyncDeleteByQueryAction.java

示例3: executeDeleteRequest

import org.elasticsearch.action.delete.DeleteRequest; //导入方法依赖的package包/类
private static BulkItemResultHolder executeDeleteRequest(final DeleteRequest deleteRequest,
                                                         final BulkItemRequest bulkItemRequest,
                                                         final IndexShard primary) throws IOException {
    Engine.DeleteResult deleteResult = executeDeleteRequestOnPrimary(deleteRequest, primary);
    if (deleteResult.hasFailure()) {
        return new BulkItemResultHolder(null, deleteResult, bulkItemRequest);
    } else {
        DeleteResponse response = new DeleteResponse(primary.shardId(), deleteRequest.type(), deleteRequest.id(),
                deleteResult.getSeqNo(), deleteResult.getVersion(), deleteResult.isFound());
        return new BulkItemResultHolder(response, deleteResult, bulkItemRequest);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:TransportShardBulkAction.java

示例4: execute

import org.elasticsearch.action.delete.DeleteRequest; //导入方法依赖的package包/类
public void execute(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
    logger.debug("delete request " + request);
    try {
        RequestUriBuilder uriBuilder = new RequestUriBuilder(request.index(), request.type(), URLEncoder.encode(request.id(), Charsets.UTF_8.displayName()));

        uriBuilder.addQueryParameterIfNotZero("version", request.version());
        uriBuilder.addQueryParameterIfNotNull("routing", request.routing());

        uriBuilder.addVersionType(request.versionType());
        uriBuilder.addConsistencyLevel(request.consistencyLevel());

        if (request.refresh()) {
            uriBuilder.addQueryParameter("refresh", true);
        }
        if (request.timeout() != ShardReplicationOperationRequest.DEFAULT_TIMEOUT) {
            uriBuilder.addQueryParameter("timeout", request.timeout().toString());
        }

        httpClient.getHttpClient().submit(HttpClientRequest.createDelete(uriBuilder.toString()))
                .flatMap(ErrorHandler.AS_FUNC)
                .flatMap(new Func1<HttpClientResponse<ByteBuf>, Observable<DeleteResponse>>() {
                    @Override
                    public Observable<DeleteResponse> call(HttpClientResponse<ByteBuf> response) {
                        return response.getContent().flatMap(new Func1<ByteBuf, Observable<DeleteResponse>>() {
                            @Override
                            public Observable<DeleteResponse> call(ByteBuf byteBuf) {
                                return DeleteResponse.parse(byteBuf);
                            }
                        });
                    }
                })
                .single()
                .subscribe(new ListenerCompleterObserver<>(listener));
    } catch (Exception e) {
        listener.onFailure(e);
    }
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:38,代码来源:DeleteActionHandler.java


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