Prateek Mittal
Prateek Mittal

Reputation: 273

@SASI.StandardAnalyzed | Tables cannot have more than 0 SASI indexes, failed to create SASI index on table user

I am using the Cassandra database (via Datastax AstraDB) for a search query like

SELECT * FROM userdb.users WHERE skill LIKE %jav% AND skill LIKE %node% AND updatedate BETWEEN "1641839170" AND "1641839370" AND City LIKE "Chen";

I read about SASI Indexes which can help with queries like the above. But while I create SASI indexes using the Spring boot application, I get the below error.

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;

}

Any help is much appreciated.

Upvotes: 1

Views: 249

Answers (1)

Alex Ott
Alex Ott

Reputation: 87234

I don't think that SASI indexes are supported by DataStax Astra - it's the old & very buggy implementation of indexing. DataStax products support Storage Attached Indexes that have less overhead compared to SASI, and should be more scalable. But I'm not sure that there is support for it directly in the Spring Data Cassandra.

Upvotes: 1

Related Questions