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

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

尝试在现有cassandra表中的多个字段(发现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\u by”:{“type”:“class\u cast\u exception”,“reason”:“java.util.arraylist无法转换为java.lang.string”}},

gopyfrb3

gopyfrb31#

必需的字段需要按如下方式查找,其余字段需要将索引设置为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"}
      }
    }
  }
}'

相关问题