Search code examples
spring-bootspring-data-jpaspring-datacouchbasespring-data-couchbase

N1qlPrimaryIndexed replacement


After update the project to Spring Data Couchbase 4, the annotation N1qlPrimaryIndexed appears as deprecated,

@Repository
@N1qlPrimaryIndexed
public interface HostelRepository extends CouchbaseRepository<Hostel, String> {
}

I would like to know if there is a replacement for it


Solution

  • Ideally, you should not be using @N1qlPrimaryIndexed in production, as it creates under-optimized indexes. As long as you have at least one index per document type, you should fine without it.

    On Spring Dara Couchabse 4, we have a new set of annotations for indexing.

    https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.repository.indexing