无法索引/发现elassandra中的多个字段

p4tfgftt  于 2021-06-15  发布在  Cassandra
关注(0)|答案(1)|浏览(365)

尝试在现有cassandra表中的多个字段(发现2个字段)上创建索引,如下代码所示。

  1. curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
  2. {
  3. "settings" : {"keyspace" : "keyspace1"},
  4. "mappings" : {
  5. "table1" : {
  6. "discover" : ["to_address", "sent_date"],
  7. "properties" : {
  8. "to_address" : {"type" : "keyword"},
  9. "sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"}
  10. }
  11. }
  12. }
  13. }'

错误:“caused\u by”:{“type”:“class\u cast\u exception”,“reason”:“java.util.arraylist无法转换为java.lang.string”}},

gopyfrb3

gopyfrb31#

必需的字段需要按如下方式查找,其余字段需要将索引设置为false。

  1. curl -XPUT -H 'Content-Type: application/json' 'http://x.x.x.x:9200/final_index' -d '
  2. {
  3. "settings" : {"keyspace" : "keyspace1"},
  4. "mappings" : {
  5. "table1" : {
  6. "discover" : (to_address|sent_date),
  7. "properties" : {
  8. "to_address" : {"type" : "keyword"},
  9. "sent_date" : {"type" : "date", "format": "yyyy-MM-dd HH:mm:ssZZ"},
  10. "contact_number" : {"index" : "false"}
  11. }
  12. }
  13. }
  14. }'

相关问题