Пример #1
0
  @Async
  @Subscribe
  public void reIndexContacts(IndexContactsEvent event) {
    log.info("Reindexing all persons");
    if (elasticSearchIndexer.hasIndex(PERSON_INDEX)) elasticSearchIndexer.dropIndex(PERSON_INDEX);

    Pageable pageRequest = new PageRequest(0, 100);
    Page<Person> persons;

    do {
      persons = personRepository.findAll(pageRequest);
      elasticSearchIndexer.indexAll(PERSON_INDEX, persons);
    } while ((pageRequest = persons.nextPageable()) != null);
  }
Пример #2
0
 @Async
 @Subscribe
 public void personUpdated(PersonUpdatedEvent event) {
   log.info("Person {} was updated", event.getPersistable());
   elasticSearchIndexer.index(PERSON_INDEX, event.getPersistable());
 }