本文整理匯總了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");
}
示例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);
}
示例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);
}
}
示例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);
}
}