Nesting tuples and UDTs

Examples of nesting tuples and UDTs in CQL lists and sets.

DSE Search supports queries for nested tuples and UDTs. For example, you can nest and declare tuples and UDTs inside CQL lists and sets. You cannot nest tuples and UDTS inside maps or keys.

Create a type with the Address tuple

CREATE TYPE Address (street text, city text, residents set<tuple<text, text>>)

Create a table with the Address tuple

CREATE TABLE Location (id text, address Address)

In the search schema, declare the TupleField and the nested TupleField

<field name="address" type="TupleField" indexed="true" stored="true"/>
<field name="address.street" type="text" indexed="true" stored="true"/>
<field name="address.city" type="text" indexed="true" stored="true"/>
<field name="address.residents" type="TupleField" indexed="true" stored="true" multiValued="true"/>
<field name="address.residents.field1" type="text" indexed="true" stored="true"/>
<field name="address.residents.field2" type="text" indexed="true" stored="true"/>

The residents nested tuple is TupleField. Each nested field is concatenated with each parent tuple or UDT by using periods.