Skip to content

Latest commit

 

History

History

boot-mongodb-elasticsearch

boot-mongodb-elasticsearch

Run tests

./mvnw clean verify

Run locally

docker-compose -f docker/docker-compose.yml up -d
./mvnw spring-boot:run -Dspring-boot.run.profiles=local

Useful Links

Mongodb Notes

Transactions with ReactiveMongoTransactionManager

@Configuration
public class DataStoreConfiguration extends AbstractReactiveMongoConfiguration {

    @Value("${spring.data.mongodb.database}")
    private String databaseName;

    @Bean
    ReactiveMongoTransactionManager transactionManager(ReactiveMongoDatabaseFactory factory) {
        return new ReactiveMongoTransactionManager(factory);
    }

    @Override
    protected String getDatabaseName() {
        return this.databaseName;
    }
}

Elastic Search Notes

UseFull ElasticSearch Commands

Reference

Exceptions & Resolutions

  • When using reactive elasticeSearch is we get below issue like raiseLimitException then solution should be to raise the memory using property
2022-10-01 21:24:14.156 ERROR 34465 --- [or-http-epoll-2] a.w.r.e.AbstractErrorWebExceptionHandler : [8006d397-1]  500 Server Error for HTTP GET "/restaurant?limit=1000&offset=1"

org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
        at org.springframework.core.io.buffer.LimitedDataBufferList.raiseLimitException(LimitedDataBufferList.java:99)

To fix this set spring.elasticsearch.webclient.max-in-memory-size=-1 for unlimited memory