Search code examples
spring-webfluxspring-data-elasticsearch

ReactiveElasticsearchRepository not auto indexing on startup


In nonreactive ElasticsearchRepository, there's a class AbstractElasticsearchRepository that does

    try {
            if (createIndexAndMapping()) {
                createIndex();
                putMapping();
            }
        } catch (Exception exception) {
            LOGGER.warn("Cannot create index: {}", exception.getMessage());
        }

Is there a different, more manual, setup for ReactiveElasticsearchRepository? My index mapping only gets created when creating a record and not on startup.


Solution

  • For reactive repositories this is implemented in 4.1.0-M1, so it will be available in the next release (or when using the milestone).

    If you cannot switch to the milestone version, you will need to create a non-reactive client as well and do the createIndex and putMapping with this client.