定義的類型在這個例子中:搜索與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