You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i want to define indexes in my @document entitys, but when ApplicationStartup, spring-data-couchbase creates indexes under myBucket._default, so i cant understand why, when i check spring data couchbase package, when index creating in CouchbasePersistentEntityIndexCreator class, createIndex function generates statement with couchbaseOperations.getBucketName(), i want to create index for collection, what is the best way for to do this ? Maybe a way for change query scope or something like that
@Repository
public interface MyEntityRepository extends CouchbaseRepository<MyEntity, String>, DynamicProxyable<MyEntityRepository> {
}
Service:
@Service
@RequiredArgsConstructor
public class MyEntityService implements BaseService<MyEntity> {
private final MyEntityRepository myEntityRepository;
public void saveAll(List<MyEntity> myEntitys) {
myEntityRepository.saveAll(myEntitys);
}
}
Configuration:
@Configuration
@EnableCouchbaseRepositories
@EnableCouchbaseAuditing
@RequiredArgsConstructor
public class CouchbaseConfiguration extends AbstractCouchbaseConfiguration {
private final CouchbaseProperties couchbaseProperties;
@Override
protected void configureEnvironment(final ClusterEnvironment.Builder builder) {
builder.securityConfig().enableTls(couchbaseProperties.getEnableTls());
builder.ioConfig().enableDnsSrv(couchbaseProperties.getEnableDnsSrv());
}
@Override
public String getConnectionString() {
return couchbaseProperties.getConnectionString();
}
@Override
public String getUserName() {
return couchbaseProperties.getUsername();
}
@Override
public String getPassword() {
return couchbaseProperties.getPassword();
}
@Override
public String getBucketName() {
return couchbaseProperties.getBucket();
}
@Override
protected boolean autoIndexCreation() { return couchbaseProperties.getAutoIndexCreation(); }
}
The text was updated successfully, but these errors were encountered:
i want to create index for collection, what is the best way for to do this ?
The best way? Do this manually outside of spring data. This @QueryIndexed annotation to start indexing on startup is problematic because it can delay startup, and also the application will complete startup before the indexing is complete giving unexpected results. Other spring data technologies that had this have removed it due to such complications.
The reason that it doesn't use the scope and collection is because the annotation was implemented before scopes and collections and not updated. I will investigate to see what is needed to update it for scopes and collections.
Hi, i want to define indexes in my @document entitys, but when ApplicationStartup, spring-data-couchbase creates indexes under myBucket._default, so i cant understand why, when i check spring data couchbase package, when index creating in
CouchbasePersistentEntityIndexCreator
class, createIndex function generates statement withcouchbaseOperations.getBucketName()
, i want to create index for collection, what is the best way for to do this ? Maybe a way for change query scope or something like thatEnvironment:
Java 21, spring-data-couchbase-5.2.1, couchbase capella 7.2.4 - couchbase sandbox 7.0.2 (same for both)
BaseDocument:
My Entity:
Repository:
Service:
Configuration:
The text was updated successfully, but these errors were encountered: