Package org.elasticsearch.action.delete

Examples of org.elasticsearch.action.delete.DeleteResponse


        response = client.prepareGet("test", "type1", "1").execute().actionGet();
        assertThat(response.exists(), equalTo(true));
        assertThat(response.sourceAsMap().get("field1").toString(), equalTo("value1_2"));
        assertThat(response.sourceAsMap().get("field2").toString(), equalTo("value2_2"));

        DeleteResponse deleteResponse = client.prepareDelete("test", "type1", "1").execute().actionGet();
        assertThat(deleteResponse.notFound(), equalTo(false));

        response = client.prepareGet("test", "type1", "1").execute().actionGet();
        assertThat(response.exists(), equalTo(false));
    }
View Full Code Here


                    // update the request with teh version so it will go to the replicas
                    deleteRequest.version(delete.version());

                    // add the response
                    responses[i] = new BulkItemResponse(item.id(), "delete",
                            new DeleteResponse(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), delete.version(), delete.notFound()));
                } catch (Exception e) {
                    logger.debug("[{}][{}] failed to bulk item (delete) {}", e, shardRequest.request.index(), shardRequest.shardId, deleteRequest);
                    responses[i] = new BulkItemResponse(item.id(), "delete",
                            new BulkItemResponse.Failure(deleteRequest.index(), deleteRequest.type(), deleteRequest.id(), ExceptionsHelper.detailedMessage(e)));
                }
View Full Code Here

        byte type = in.readByte();
        if (type == 0) {
            response = new IndexResponse();
            response.readFrom(in);
        } else if (type == 1) {
            response = new DeleteResponse();
            response.readFrom(in);
        }

        if (in.readBoolean()) {
            failure = new Failure(in.readUTF(), in.readUTF(), in.readUTF(), in.readUTF());
View Full Code Here

            indexType = getEndpoint().getConfig().getIndexType();
        }

        String indexId = exchange.getIn().getBody(String.class);

        DeleteResponse response = client.prepareDelete(indexName, indexType, indexId).execute().actionGet();
        exchange.getIn().setBody(response);
    }
View Full Code Here

        GetResponse response = template.requestBody("direct:get", indexId, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());

        //now, perform DELETE
        DeleteResponse deleteResponse = template.requestBody("direct:delete", indexId, DeleteResponse.class);
        assertNotNull("response should not be null", deleteResponse);

        //now, verify GET fails to find the indexed value
        response = template.requestBody("direct:get", indexId, GetResponse.class);
        assertNotNull("response should not be null", response);
View Full Code Here

        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());

        //now, perform DELETE
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_DELETE);
        DeleteResponse deleteResponse = template.requestBodyAndHeaders("direct:start", indexId, headers, DeleteResponse.class);
        assertNotNull("response should not be null", deleteResponse);

        //now, verify GET fails to find the indexed value
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_GET_BY_ID);
        response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
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.isFound()) {
      if (logger.isDebugEnabled()) {
        logger.debug("{} document doesn't exist in JIRA river persistent store", documentName);
      }
      return false;
    } else {
View Full Code Here

                setSource(b);
        irb.execute().actionGet();
    }

    public void deleteById(String id) {
        DeleteResponse response = client.prepareDelete(getIndexName(), getIndexType(), id).
                execute().
                actionGet();
    }
View Full Code Here

    DeleteRequestBuilder drb = _elasticClient.prepareDelete(_sIndexName, _sIndexType, _id);
    if (null != sParentId) {
      drb.setRouting(sParentId);
    }
    drb.setConsistencyLevel(WriteConsistencyLevel.ONE);
    DeleteResponse dr = drb.execute().actionGet();
    return DeleteResponseUtils.isFound(dr);
   
  }//TESTED (including children)
View Full Code Here

    Assert.assertNotNull(indexedBeer);
    Assert.assertEquals(beer, indexedBeer);

    // delete document
    DeleteResponse dr = null;
   
    // TODO Remove from elasticsearch the indexed beer

    Assert.assertNotNull(dr);
    Assert.assertTrue(dr.isFound());

    // TODO get the beer we have just removed

    Assert.assertNotNull(gr);
    // Beer should not exist anymore
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.