Java Code Examples for org.elasticsearch.action.DocWriteResponse.Result#DELETED

The following examples show how to use org.elasticsearch.action.DocWriteResponse.Result#DELETED . 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: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 5 votes vote down vote up
@Deprecated
public DeleteResponse delete(final String index, final String type, final String id,
        final BuilderCallback<DeleteRequestBuilder> builder) {
    final DeleteResponse actionGet = builder.apply(client().prepareDelete(index, type, id)).execute().actionGet();
    if (actionGet.getResult() != Result.DELETED) {
        onFailure("Failed to delete " + id + " from " + index + "/" + type + ".", actionGet);
    }
    return actionGet;
}
 
Example 2
Source File: ElasticsearchClusterRunner.java    From elasticsearch-cluster-runner with Apache License 2.0 5 votes vote down vote up
public DeleteResponse delete(final String index, final String id,
        final BuilderCallback<DeleteRequestBuilder> builder) {
    final DeleteResponse actionGet = builder.apply(client().prepareDelete().setIndex(index).setId(id)).execute().actionGet();
    if (actionGet.getResult() != Result.DELETED) {
        onFailure("Failed to delete " + id + " from " + index + ".", actionGet);
    }
    return actionGet;
}
 
Example 3
Source File: EsAbstractBehavior.java    From fess with Apache License 2.0 5 votes vote down vote up
@Override
protected int delegateDelete(final Entity entity, final DeleteOption<? extends ConditionBean> option) {
    final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
    final DeleteRequestBuilder builder = createDeleteRequest(esEntity);

    final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
    return response.getResult() == Result.DELETED ? 1 : 0;
}
 
Example 4
Source File: EsAbstractBehavior.java    From fess with Apache License 2.0 5 votes vote down vote up
@Override
protected int delegateDelete(final Entity entity, final DeleteOption<? extends ConditionBean> option) {
    final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
    final DeleteRequestBuilder builder = createDeleteRequest(esEntity);

    final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
    return response.getResult() == Result.DELETED ? 1 : 0;
}
 
Example 5
Source File: FessEsClient.java    From fess with Apache License 2.0 5 votes vote down vote up
public boolean delete(final String index, final String id, final Number seqNo, final Number primaryTerm) {
    try {
        final DeleteRequestBuilder builder = client.prepareDelete().setIndex(index).setId(id).setRefreshPolicy(RefreshPolicy.IMMEDIATE);
        if (seqNo != null) {
            builder.setIfSeqNo(seqNo.longValue());
        }
        if (primaryTerm != null) {
            builder.setIfPrimaryTerm(primaryTerm.longValue());
        }
        final DeleteResponse response = builder.execute().actionGet(ComponentUtil.getFessConfig().getIndexDeleteTimeout());
        return response.getResult() == Result.DELETED;
    } catch (final ElasticsearchException e) {
        throw new FessEsClientException("Failed to delete: " + index + "/" + id + "@" + seqNo + ":" + primaryTerm, e);
    }
}
 
Example 6
Source File: EsAbstractBehavior.java    From fess with Apache License 2.0 5 votes vote down vote up
@Override
protected int delegateDelete(final Entity entity, final DeleteOption<? extends ConditionBean> option) {
    final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
    final DeleteRequestBuilder builder = createDeleteRequest(esEntity);

    final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
    return response.getResult() == Result.DELETED ? 1 : 0;
}