【问题标题】:Cassandra Stratio Failed to execute readCassandra Stratio 无法执行读取
【发布时间】:2016-09-30 07:49:35
【问题描述】:

这是我的查询:

select * from profiles where expr(profiles_index, '{ 
  filter: { 
    type: "date_range", 
    field: "age", 
    from: "1984/01/01", 
    to: "2010/01/01", 
    operation: "is_within" 
  } 
}');

这是我的桌子:

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(最近一次调用最后一次):文件 “/opt/apache-cassandra-3.0.3/bin/cqlsh.py”,第 1249 行,在 perform_simple_statement 结果 = future.result() 文件“/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", 第 3122 行,结果 raise self._final_exception ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 响应和 1 次失败” info={'failures': 1, 'received_responses': 0, 'required_responses': 1, '一致性': 'ONE'}

有人知道我为什么会收到这个错误吗?

【问题讨论】:

    标签: cassandra stratio cassandra-lucene-index


    【解决方案1】:

    @user1019182 完全正确,“date_range”搜索旨在与使用“date_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 默认时间戳格式与此无关。

    【讨论】:

      【解决方案2】:

      我需要使用“范围”搜索,而不是“日期范围”搜索。如果您使用“日期范围”搜索,最好使用“日期范围映射器”。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-02-01
        • 1970-01-01
        • 2018-10-09
        • 1970-01-01
        • 2023-02-16
        相关资源
        最近更新 更多