在cassandra

时间:2019-07-17 05:15:04

标签: django cassandra-3.0

我在Cassandra中有一个表,我想在多列上创建索引。

假设我有一个名为 Xyz 的表,其中包含日期,名称,地址,号码,电子邮件,Dob,is_active 列,而我的查询类似于:

Xyz.objects.filter(date__gte=date, date__lte=date, is_active=True)

对于每个请求,此查询都会执行大约。 365-400 次,因此大约需要 33秒才能完成请求。我想最小化响应时间,并且试图在Cassandra中的多个列上创建自定义索引,但是在创建索引时遇到错误。

我尝试使用以下方法创建自定义索引:

CREATE CUSTOM INDEX my_index on my_keyspace.xyz (date, is_active) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { 'mode': 'CONTAINS' };

我收到此错误:

ConfigurationException: <Error from server: code=2300 [Query invalid because of configuration issue] message="Failed to validate custom indexer options: {mode=CONTAINS, class_name=org.apache.cassandra.index.sasi.SASIIndex, target=date, is_active}">

还有其他解决方法吗?

0 个答案:

没有答案