Cassandra Stratio 执行读取失败
Cassandra Stratio Failed to execute read
这是我的查询:
select * from profiles where expr(profiles_index, '{
filter: {
type: "date_range",
field: "age",
from: "1984/01/01",
to: "2010/01/01",
operation: "is_within"
}
}');
这是我的 table:
CREATE TABLE profiles (
user_id timeuuid,
age timestamp,
PRIMARY KEY (user_id)
);
我的架构看起来像这样:
CREATE CUSTOM INDEX profiles_index ON profiles ()
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds' : '60',
'schema' : '{
default_analyzer : "english",
fields : {
age : {type : "date",
validated : true,
pattern : "yyyy/MM/dd"
}
}
}'
};
而且我遇到了这个异常:
Traceback (most recent call last): File
"/opt/apache-cassandra-3.0.3/bin/cqlsh.py", line 1249, in
perform_simple_statement
result = future.result() File "/opt/apache-cassandra-3.0.3/bin/../lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py",
line 3122, in result
raise self._final_exception ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0
responses and 1 failures" info={'failures': 1, 'received_responses':
0, 'required_responses': 1, 'consistency': 'ONE'}
有人知道我为什么会收到此错误吗?
我需要使用 "Range" 搜索,而不是 "Date Range" 搜索。如果您使用 "Date Range" 搜索,您最好使用 "Date Range Mapper".
@user1019182 完全正确,"date_range" 搜索旨在与使用 "date_range" 映射器索引的数据一起使用,该映射器使用空间方法对由开始日期和结束日期组成的持续时间进行索引。
要在一段时间内搜索简单日期,您应该使用 "range" 搜索:
select * from profiles where expr(profiles_index, '{
filter: {
type: "range",
field: "age",
lower: "1984/01/01",
upper: "2010/01/01",
include_lower: true,
include_upper:true
}
}');
@mahendra-singh 错了,cqlsh 默认时间戳格式与此无关。
这是我的查询:
select * from profiles where expr(profiles_index, '{
filter: {
type: "date_range",
field: "age",
from: "1984/01/01",
to: "2010/01/01",
operation: "is_within"
}
}');
这是我的 table:
CREATE TABLE profiles (
user_id timeuuid,
age timestamp,
PRIMARY KEY (user_id)
);
我的架构看起来像这样:
CREATE CUSTOM INDEX profiles_index ON profiles ()
USING 'com.stratio.cassandra.lucene.Index'
WITH OPTIONS = {
'refresh_seconds' : '60',
'schema' : '{
default_analyzer : "english",
fields : {
age : {type : "date",
validated : true,
pattern : "yyyy/MM/dd"
}
}
}'
};
而且我遇到了这个异常:
Traceback (most recent call last): File "/opt/apache-cassandra-3.0.3/bin/cqlsh.py", line 1249, in perform_simple_statement result = future.result() File "/opt/apache-cassandra-3.0.3/bin/../lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", line 3122, in result raise self._final_exception ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
有人知道我为什么会收到此错误吗?
我需要使用 "Range" 搜索,而不是 "Date Range" 搜索。如果您使用 "Date Range" 搜索,您最好使用 "Date Range Mapper".
@user1019182 完全正确,"date_range" 搜索旨在与使用 "date_range" 映射器索引的数据一起使用,该映射器使用空间方法对由开始日期和结束日期组成的持续时间进行索引。
要在一段时间内搜索简单日期,您应该使用 "range" 搜索:
select * from profiles where expr(profiles_index, '{
filter: {
type: "range",
field: "age",
lower: "1984/01/01",
upper: "2010/01/01",
include_lower: true,
include_upper:true
}
}');
@mahendra-singh 错了,cqlsh 默认时间戳格式与此无关。