Elassandra 中不能 Indexing/discover 多个字段
Cannot Indexing/discover multiple fields in Elassandra
尝试在现有 Cassandra table 中的多个字段(发现 2 个字段)上创建索引,如下代码所示。
curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
{
"settings" : {"keyspace" : "keyspace1"},
"mappings" : {
"table1" : {
"discover" : ["to_address", "sent_date"],
"properties" : {
"to_address" : {"type" : "keyword"},
"sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"}
}
}
}
}'
错误: "caused_by":{"type":"class_cast_exception","reason":"java.util.ArrayList cannot be cast to java.lang.String"}},
需要如下发现必填字段,其余字段需要将 Index 设置为 false。
curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
{
"settings" : {"keyspace" : "keyspace1"},
"mappings" : {
"table1" : {
"discover" : (to_address|sent_date),
"properties" : {
"to_address" : {"type" : "keyword"},
"sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"},
"contact_number" : {"index" : "false"}
}
}
}
}'
尝试在现有 Cassandra table 中的多个字段(发现 2 个字段)上创建索引,如下代码所示。
curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
{
"settings" : {"keyspace" : "keyspace1"},
"mappings" : {
"table1" : {
"discover" : ["to_address", "sent_date"],
"properties" : {
"to_address" : {"type" : "keyword"},
"sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"}
}
}
}
}'
错误: "caused_by":{"type":"class_cast_exception","reason":"java.util.ArrayList cannot be cast to java.lang.String"}},
需要如下发现必填字段,其余字段需要将 Index 设置为 false。
curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
{
"settings" : {"keyspace" : "keyspace1"},
"mappings" : {
"table1" : {
"discover" : (to_address|sent_date),
"properties" : {
"to_address" : {"type" : "keyword"},
"sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"},
"contact_number" : {"index" : "false"}
}
}
}
}'