【问题标题】:Cannot Indexing/discover multiple fields in Elassandra无法索引/发现 Elassandra 中的多个字段
【发布时间】:2018-11-05 17:21:19
【问题描述】:

尝试在现有 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_by":{"type":"class_cast_exception","re​​ason":"java.util.ArrayList 无法转换为 java.lang.String"}},

【问题讨论】:

    标签: elasticsearch cassandra elassandra


    【解决方案1】:

    必填字段需要如下发现,其余字段需要将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"}
          }
        }
      }
    }'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-09
      • 2016-01-18
      相关资源
      最近更新 更多