我正在使用Cassandra数据库(通过Datastax AstraDB)进行搜索查询,如
SELECT * FROM userdb.users WHERE skill LIKE %jav% AND skill LIKE %node% AND updatedate BETWEEN "1641839170" AND "1641839370" AND City LIKE "Chen";
我读到关于SASI索引可以帮助查询像上面。但是,当我使用Spring引导应用程序创建SASI索引时,我得到了以下错误:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Tables cannot have more than 0 SASI indexes, failed to create SASI index on table user"
UserModel:
@Table
@Data
@Builder
public class User {
@PrimaryKey private Long userId;
private String username;
@SASI(indexMode = CONTAINS)
@SASI.StandardAnalyzed
private String skill;
@SASI(indexMode = CONTAINS)
@SASI.StandardAnalyzed
private String project;
@SASI(indexMode = CONTAINS)
@SASI.StandardAnalyzed
private String city;
@Column("updatedDate")
@CassandraType(type = CassandraType.Name.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", shape = JsonFormat.Shape.STRING)
private LocalDateTime updatedDate;
@Column("createdDate")
@CassandraType(type = CassandraType.Name.TIMESTAMP)
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ", shape = JsonFormat.Shape.STRING)
private LocalDateTime createdDate;
}
任何帮助都非常感谢。
我认为DataStax Astra不支持SASI索引-它是旧的&索引的实现非常有bug。DataStax产品支持存储附加索引,与SASI相比,存储附加索引的开销更小,并且应该具有更高的可伸缩性。但是我不确定在Spring Data Cassandra中是否直接支持它。