Package org.elasticsearch.action.delete

Examples of org.elasticsearch.action.delete.DeleteResponse


      logger.debug("Going to delete datetime value from {} property for project {}. Document name is {}.",
          propertyName, projectKey, documentName);

    refreshSearchIndex(getRiverIndexName());

    DeleteResponse lastSeqGetResponse = client.prepareDelete(getRiverIndexName(), riverName.name(), documentName)
        .execute().actionGet();
    if (lastSeqGetResponse.isNotFound()) {
      if (logger.isDebugEnabled()) {
        logger.debug("{} document doesn't exist in JIRA river persistent store", documentName);
      }
      return false;
    } else {
View Full Code Here


      logger.debug("Going to delete datetime value from {} property for project {}. Document name is {}.",
          propertyName, projectKey, documentName);

    refreshSearchIndex(getRiverIndexName());

    DeleteResponse lastSeqGetResponse = client.prepareDelete(getRiverIndexName(), riverName.name(), documentName)
        .execute().actionGet();
    if (lastSeqGetResponse.isNotFound()) {
      if (logger.isDebugEnabled()) {
        logger.debug("{} document doesn't exist in JIRA river persistent store", documentName);
      }
      return false;
    } else {
View Full Code Here

    // 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
    boolean actual = entityDao.delete(ESNode.class, 1l);

    // Assert
View Full Code Here

    // 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
    boolean actual = entityDao.delete(ESNode.class, 1l);

    // Assert
View Full Code Here

      logger.debug("Going to delete datetime value from {} property for space {}. Document name is {}.", propertyName,
          spaceKey, documentName);

    refreshSearchIndex(getRiverIndexName());

    DeleteResponse lastSeqGetResponse = client.prepareDelete(getRiverIndexName(), riverName.name(), documentName)
        .execute().actionGet();
    if (!lastSeqGetResponse.isFound()) {
      if (logger.isDebugEnabled()) {
        logger.debug("{} document doesn't exist in remote river persistent store", documentName);
      }
      return false;
    } else {
View Full Code Here

    @Override
    public void unIndex(Class entityClazz, Object entity, EntityMetadata metadata, MetamodelImpl metamodelImpl)
    {
        Object id = PropertyAccessorHelper.getId(entity, metadata);
        DeleteResponse response = client
                .prepareDelete(metadata.getSchema().toLowerCase(), entityClazz.getSimpleName(), id.toString())
                .execute().actionGet();
    }
View Full Code Here

    @BenchmarkOptions(benchmarkRounds = BENCHMARK_ROUNDS, warmupRounds = 1)
    @Test
    public void testDeleteApiById() throws Exception {
        for (int i=0; i<NUM_REQUESTS_PER_TEST; i++) {
            DeleteResponse response = getClient(false).execute(DeleteAction.INSTANCE, getDeleteApiByIdRequest()).actionGet();
            assertTrue(response.isFound());
        }
    }
View Full Code Here

        SearchResponse searchResponse = client().prepareSearch("test").get();
        assertNoFailures(searchResponse);
        assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs));

        //use routing
        DeleteResponse deleteResponse = client().prepareDelete("test", "test", firstDocId).setRouting("routing").get();
        assertThat(deleteResponse.isFound(), equalTo(true));
        GetResponse getResponse = client().prepareGet("test", "test", firstDocId).setRouting("routing").get();
        assertThat(getResponse.isExists(), equalTo(false));
        refresh();
        searchResponse = client().prepareSearch("test").get();
        assertNoFailures(searchResponse);
        assertThat(searchResponse.getHits().totalHits(), equalTo((long) numDocs - 1));

        //don't use routing and trigger a broadcast delete
        deleteResponse = client().prepareDelete("test", "test", secondDocId).get();
        assertThat(deleteResponse.isFound(), equalTo(true));

        getResponse = client().prepareGet("test", "test", secondDocId).setRouting(secondRouting).get();
        assertThat(getResponse.isExists(), equalTo(false));
        refresh();
        searchResponse = client().prepareSearch("test").setSize(numDocs).get();
View Full Code Here

        assertThat(getResponse.isExists(), equalTo(true));
        assertThat(getResponse.getIndex(), equalTo("test"));
        assertThat(getResponse.getType(), equalTo("type"));
        assertThat(getResponse.getId(), equalTo(docId));

        DeleteResponse deleteResponse = client().prepareDelete(indexOrAlias(), "type", docId).get();
        assertThat(deleteResponse.isFound(), equalTo(true));
        assertThat(deleteResponse.getIndex(), equalTo("test"));
        assertThat(deleteResponse.getType(), equalTo("type"));
        assertThat(deleteResponse.getId(), equalTo(docId));

        getResponse = client().prepareGet(indexOrAlias(), "type", docId).get();
        assertThat(getResponse.isExists(), equalTo(false));

        refresh();
View Full Code Here

                    if (itemResponse.isFailed()) {
                        builder.field(Fields.STATUS, itemResponse.getFailure().getStatus().getStatus());
                        builder.field(Fields.ERROR, itemResponse.getFailure().getMessage());
                    } else {
                        if (itemResponse.getResponse() instanceof DeleteResponse) {
                            DeleteResponse deleteResponse = itemResponse.getResponse();
                            if (deleteResponse.isFound()) {
                                builder.field(Fields.STATUS, RestStatus.OK.getStatus());
                            } else {
                                builder.field(Fields.STATUS, RestStatus.NOT_FOUND.getStatus());
                            }
                            builder.field(Fields.FOUND, deleteResponse.isFound());
                        } else if (itemResponse.getResponse() instanceof IndexResponse) {
                            IndexResponse indexResponse = itemResponse.getResponse();
                            if (indexResponse.isCreated()) {
                                builder.field(Fields.STATUS, RestStatus.CREATED.getStatus());
                            } else {
View Full Code Here

TOP

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

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.