Closed
Description
@Document
@CompositeQueryIndex(name="AnotherEntity_idx", fields = {"anotherEntity.id"})
public class DatabaseEntity {
private AnotherEntity anotherEntity;
....
}
Index generation will fail with the error:
Could not auto-create index with statement: CREATE INDEX idx_databasentity_anotherentity.id ON .....
note period '.' in index name. Apparently couchbase does not like it.
It probably could either replace '.' with '_' and/or, use index name provided in the annotation?
I can create the index manually through couchbase admin webapp if index name was acceptable.
The code is in CouchbasePersistentEntityIndexResolver createCompositeQueryIndexDefinitions method. As you cen see it appends field name and does not consider annotation index name.
line 133: String indexName = "idx_" + StringUtils.uncapitalize(entity.getType().getSimpleName()) + "_" + fieldsIndexName;