@Test
 public void shouldSaveDocument() {
   // given
   String documentId = randomNumeric(5);
   SampleEntity sampleEntity = new SampleEntity();
   sampleEntity.setId(documentId);
   sampleEntity.setMessage("some message");
   sampleEntity.setVersion(System.currentTimeMillis());
   // when
   repository.save(sampleEntity);
   // then
   SampleEntity entityFromElasticSearch = repository.findOne(documentId);
   assertThat(entityFromElasticSearch, is(notNullValue()));
 }
  @Test
  public void shouldDoBulkIndexDocument() {
    // given
    String documentId1 = randomNumeric(5);
    SampleEntity sampleEntity1 = new SampleEntity();
    sampleEntity1.setId(documentId1);
    sampleEntity1.setMessage("some message");
    sampleEntity1.setVersion(System.currentTimeMillis());

    String documentId2 = randomNumeric(5);
    SampleEntity sampleEntity2 = new SampleEntity();
    sampleEntity2.setId(documentId2);
    sampleEntity2.setMessage("some message");
    sampleEntity2.setVersion(System.currentTimeMillis());

    // when
    repository.save(Arrays.asList(sampleEntity1, sampleEntity2));
    // then
    SampleEntity entity1FromElasticSearch = repository.findOne(documentId1);
    assertThat(entity1FromElasticSearch, is(notNullValue()));

    SampleEntity entity2FromElasticSearch = repository.findOne(documentId2);
    assertThat(entity2FromElasticSearch, is(notNullValue()));
  }
  @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()));
  }