Trying to create index on multiple fields (discovering 2 fields) in existing Cassandra table as below code.
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"}
}
}
}
}'
Error: "caused_by":{"type":"class_cast_exception","reason":"java.util.ArrayList cannot be cast to java.lang.String"}},
Required fields need to be discovered as below and remaining fields need to set Index as 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"}
}
}
}
}'