Java Code Examples for org.elasticsearch.action.delete.DeleteRequestBuilder#setVersion()

The following examples show how to use org.elasticsearch.action.delete.DeleteRequestBuilder#setVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultElasticSearchService.java    From vertx-elasticsearch-service with Apache License 2.0 5 votes vote down vote up
private void populateDeleteRequestBuilder(DeleteRequestBuilder builder, DeleteOptions options) {
    if (options != null) {
        if (options.getRouting() != null) builder.setRouting(options.getRouting());
        if (options.getParent() != null) builder.setParent(options.getParent());
        if (options.getRefreshPolicy() != null)
            builder.setRefreshPolicy(WriteRequest.RefreshPolicy.valueOf(options.getRefreshPolicy().name()));
        if (options.getWaitForActiveShard() != null)
            builder.setWaitForActiveShards(options.getWaitForActiveShard());
        if (options.getVersion() != null) builder.setVersion(options.getVersion());
        if (options.getVersionType() != null) builder.setVersionType(options.getVersionType());
        if (options.getTimeout() != null) builder.setTimeout(options.getTimeout());
    }
}
 
Example 2
Source File: InternalEsClient.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * 非同期でversionつきでdocumentを削除します.
 * @param index インデックス名
 * @param type タイプ名
 * @param id Document id to delete
 * @param routingId routingId
 * @param version The version of the document to delete
 * @return 非同期応答
 */
public ActionFuture<DeleteResponse> asyncDelete(String index, String type,
        String id, String routingId, long version) {
    DeleteRequestBuilder req = esTransportClient.prepareDelete(index, type, id)
            .setRefresh(true);
    if (routingFlag) {
        req = req.setRouting(routingId);
    }
    if (version > -1) {
        req.setVersion(version);
    }
    ActionFuture<DeleteResponse> ret = req.execute();
    this.fireEvent(Event.afterRequest, index, type, id, null, "Delete");
    return ret;
}
 
Example 3
Source File: InternalEsClient.java    From io with Apache License 2.0 5 votes vote down vote up
/**
 * 非同期でversionつきでdocumentを削除します.
 * @param index インデックス名
 * @param type タイプ名
 * @param id Document id to delete
 * @param routingId routingId
 * @param version The version of the document to delete
 * @return 非同期応答
 */
public ActionFuture<DeleteResponse> asyncDelete(String index, String type,
        String id, String routingId, long version) {
    DeleteRequestBuilder req = esTransportClient.prepareDelete(index, type, id)
            .setRefresh(true);
    if (routingFlag) {
        req = req.setRouting(routingId);
    }
    if (version > -1) {
        req.setVersion(version);
    }
    ActionFuture<DeleteResponse> ret = req.execute();
    this.fireEvent(Event.afterRequest, index, type, id, null, "Delete");
    return ret;
}