Package org.elasticsearch.action.delete

Examples of org.elasticsearch.action.delete.DeleteRequestBuilder.execute()


    try {
      DeleteRequestBuilder builder = client.prepareDelete();
      builder.setIndex(defaultIndex);
      builder.setType("doc");
      builder.setId(key);
      builder.execute().actionGet();
    } catch (ElasticsearchException e) {
      throw makeIOException(e);
    }
  }
View Full Code Here


    try{
      DeleteRequestBuilder builder =  client.prepareDelete();
      builder.setIndex(defaultIndex);
      builder.setType("doc");
      builder.setId(key);
      builder.execute().actionGet();
    }catch(ElasticSearchException e)
    {
      throw makeIOException(e);
    }
  }
View Full Code Here

  @Override
  public void delete(String key) throws IOException {
    try{
      DeleteRequestBuilder builder =  client.prepareDelete();
      builder.setId(key);
      builder.execute().actionGet();
    }catch(ElasticSearchException e)
    {
      throw makeIOException(e);
    }
  }
View Full Code Here

  public void delete() {
    // Setup
    DeleteRequestBuilder deleteRequestBuilder = mock(DeleteRequestBuilder.class);
    when(clientMocked.prepareDelete(any(String.class), any(String.class), any(String.class))).thenReturn(deleteRequestBuilder);
    ListenableActionFuture<DeleteResponse> listenableActionFutureMocked = mock(ListenableActionFuture.class);
    when(deleteRequestBuilder.execute()).thenReturn(listenableActionFutureMocked);
    DeleteResponse deleteResponseMocked = mock(DeleteResponse.class);
    when(listenableActionFutureMocked.actionGet()).thenReturn(deleteResponseMocked);
    when(deleteResponseMocked.isFound()).thenReturn(true);

    // Action
View Full Code Here

  public void delete_withNotFoundDocument() {
    // Setup
    DeleteRequestBuilder deleteRequestBuilder = mock(DeleteRequestBuilder.class);
    when(clientMocked.prepareDelete(any(String.class), any(String.class), any(String.class))).thenReturn(deleteRequestBuilder);
    ListenableActionFuture<DeleteResponse> listenableActionFutureMocked = mock(ListenableActionFuture.class);
    when(deleteRequestBuilder.execute()).thenReturn(listenableActionFutureMocked);
    DeleteResponse deleteResponseMocked = mock(DeleteResponse.class);
    when(listenableActionFutureMocked.actionGet()).thenReturn(deleteResponseMocked);
    when(deleteResponseMocked.isFound()).thenReturn(false);

    // Action
View Full Code Here

  public void delete_withBrokenConnector() {
    // Setup
    DeleteRequestBuilder deleteRequestBuilder = mock(DeleteRequestBuilder.class);
    when(clientMocked.prepareDelete(any(String.class), any(String.class), any(String.class))).thenReturn(deleteRequestBuilder);
    ListenableActionFuture<DeleteResponse> listenableActionFutureMocked = mock(ListenableActionFuture.class);
    when(deleteRequestBuilder.execute()).thenReturn(listenableActionFutureMocked);
    when(listenableActionFutureMocked.actionGet()).thenThrow(new ElasticsearchException("Simulated exception"));

    // Action
    entityDao.delete(ESNode.class, 1l);
  }
View Full Code Here

    String type = uri.getType();
    String uid = uri.getUID();

    DeleteRequestBuilder deleteRequest = nodeClient.prepareDelete(index, type, uid);
    deleteRequest.setRefresh(true);
    DeleteResponse delete = deleteRequest.execute().actionGet();
    if (delete.notFound()) {
      logger.trace("Document {} to delete was not found", uri);
      return false;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.