Package org.elasticsearch.action.delete

Examples of org.elasticsearch.action.delete.DeleteRequestBuilder


  }

  @Override
  public void delete(String key) throws IOException {
    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.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

  /* DELETE */

  @Test
  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

  }

  @Test
  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

  }

  @Test(expected = DaoException.class)
  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

  /**
   * @return null if object doesn't have an id
   */
  @CheckForNull
  public final DeleteRequest deleteRequest(String indexName, String id, Long version) {
    DeleteRequestBuilder builder = populate(new DeleteRequestBuilder(null), indexName, id, version);
    return builder == null ? null : builder.request();
  }
View Full Code Here

        execute(DeleteAction.INSTANCE, request, listener);
    }

    @Override
    public DeleteRequestBuilder prepareDelete() {
        return new DeleteRequestBuilder(this, null);
    }
View Full Code Here

    String index = uri.getSite().getIdentifier();
    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

Related Classes of org.elasticsearch.action.delete.DeleteRequestBuilder

Copyright © 2018 www.massapicom. 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.