@Test
 public void shouldDeleteDocument() {
   // given
   String documentId = randomNumeric(5);
   SampleEntity sampleEntity = new SampleEntity();
   sampleEntity.setId(documentId);
   sampleEntity.setMessage("some message");
   sampleEntity.setVersion(System.currentTimeMillis());
   repository.save(sampleEntity);
   // when
   repository.delete(documentId);
   // then
   SampleEntity entityFromElasticSearch = repository.findOne(documentId);
   assertThat(entityFromElasticSearch, is(nullValue()));
 }
 @Test
 public void shouldDeleteEntity() {
   // given
   String documentId = randomNumeric(5);
   SampleEntity sampleEntity = new SampleEntity();
   sampleEntity.setId(documentId);
   sampleEntity.setMessage("hello world.");
   sampleEntity.setVersion(System.currentTimeMillis());
   repository.save(sampleEntity);
   // when
   repository.delete(sampleEntity);
   // then
   SearchQuery searchQuery =
       new NativeSearchQueryBuilder().withQuery(termQuery("id", documentId)).build();
   Page<SampleEntity> sampleEntities = repository.search(searchQuery);
   assertThat(sampleEntities.getTotalElements(), equalTo(0L));
 }
  @Test
  public void shouldDeleteIterableEntities() {
    // given
    String documentId1 = randomNumeric(5);
    SampleEntity sampleEntity1 = new SampleEntity();
    sampleEntity1.setId(documentId1);
    sampleEntity1.setMessage("hello world.");
    sampleEntity1.setVersion(System.currentTimeMillis());

    String documentId2 = randomNumeric(5);
    SampleEntity sampleEntity2 = new SampleEntity();
    sampleEntity2.setId(documentId2);
    sampleEntity2.setMessage("hello world.");
    sampleEntity2.setVersion(System.currentTimeMillis());
    repository.save(sampleEntity2);

    Iterable<SampleEntity> sampleEntities = Arrays.asList(sampleEntity2, sampleEntity2);
    // when
    repository.delete(sampleEntities);
    // then
    assertThat(repository.findOne(documentId1), is(nullValue()));
    assertThat(repository.findOne(documentId2), is(nullValue()));
  }