定义的类型在这个例子中:搜索与Apache Cassandra的
CREATE TYPE address (
street text,
city text,
zip_code int,
phones set<text>
)
CREATE TABLE users (
id uuid PRIMARY KEY,
name text,
addresses map<string, address>
)
我如何可以查询用户city = newyork
或找到一个特定的电话号码的用户。
我同意接受的答案,您应该考虑以一种更适合Cassandra的方式重新设计您的数据模型。但是,更广泛地说,将Cassandra与Apache Solr集成允许查询非主键字段,包括用户定义的类型:http://docs.datastax.com/en/latest-dse/datastax_enterprise/srch/srchUDT.html(链接为在Solr中为DataStax企业Cassanra软件包配置UDT的指南,该软件包不是免费的)。 – JohnC