在Elassandra中创建映射时出错

时间:2019-02-04 07:16:33

标签: elasticsearch cassandra elassandra

我正在测试Elassandra,并且在在现存的Cassandra表和Elasticsearch之间创建映射时遇到一些问题。

根据文档,我使用了以下PUT请求:

PUT to http://localhost:9200/my_index/_mapping/my_table:

{
    "my_table" : {
        "discover" : ".*",
        "properties" : {
            "deviceid" : {
                "type" : "text",
            "timestamp": {
                "type": "date"
            }
        }
    }
}

不幸的是,我收到此错误,但我不确定为什么:

{
    "error": {
        "root_cause": [
            {
                "type": "mapper_parsing_exception",
                "reason": "Failed to execute query:null : Existing column [timestamp] type [timestamp] mismatch with inferred type [timestamp]"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "Failed to execute query:null : Existing column [timestamp] type [timestamp] mismatch with inferred type [timestamp]",
        "caused_by": {
            "type": "configuration_exception",
            "reason": "Existing column [timestamp] type [timestamp] mismatch with inferred type [timestamp]"
        }
    },
    "status": 400
}

Cassandra表中肯定包含一列timestamp作为数据类型。在这里您可以看到desc my_keyspace的摘录:

CREATE TABLE my_keyspace.my_table (
    deviceid text,
    timestamp timestamp,
    other_column text,
    PRIMARY KEY ((deviceid, other_column), timestamp)
) WITH CLUSTERING ORDER BY (timestamp DESC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 
'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 
'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 
'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

有人可以给我一些有关Elassandra的帮助,并解释为什么会发生此错误吗?预先感谢。

2 个答案:

答案 0 :(得分:0)

尝试“时间戳”:{“类型”:“日期”,“格式”:“ yyyy-MM-dd HH:mm:ssZZ”}

答案 1 :(得分:0)

Elassandra v6.2.3.10中存在一个错误,该错误使得无法索引按降序排序的聚类键。

v6.2.3.11即将发布,并解决了该问题。在此期间,您可以使用v6.2.3.9。