Indexing tuples and UDTs fields
Guidelines
Guidelines for advanced data types, including tuples and user-defined types (UDT):
-
The tuple data type holds fixed-length sets of typed positional fields. Use a tuple as an alternative to a UDT.
-
A UDT facilitates handling multiple fields of related information in a table. UDTs are a specialization of tuples. All examples and documentation references to tuples apply to both tuples and UDTs.
Simplify applications that require multiple tables by using UDTs to represent the related fields of information, instead of storing the information in a separate table.
DSE Search does not support:
-
Tuples and UDTs that are used inside primary key declarations.
-
Tuples and UDTs that are used as CQL map values. Instead, use a workaround to simulate a map-like data model.
-
Dynamic fields as tuples or UDTs.
-
Tuple/UDT subfield sorting and faceting.
Performance and memory
Tuples and UDTs are read and written as a single unit of information. Consider performance and memory impact when working with tuples and UDTs. Subfields are managed as the full tuple or UDT, and are not handled individually.
Highlights
Add CQL tuple and user-defined type (UDT) columns to an existing search index.
-
Define a field for the table column using the DataStax Tuple class (
com.datastax.bdp.search.solr.core.types.TupleField
). -
Define a field for each value in the CQL tuple or UDT column using the corresponding Solr field type.
The schema field name is
column_name.field<N>
where the <column_name> matches the CQL column and <N> is the field position starting at 1.
- xref:search-index:tuple-add.adoc[Tuple configuration example}
-
Example of tuple configuration for DSE Search.
- UDT configuration example
-
Example of UDT configuration for DSE Search.
- Nesting tuples and UDTs
-
Examples of nesting tuples and UDTs in CQL lists and sets.
- Tuples and UDTs as CQL map values
-
Workaround for using tuples and UDTs as CQL map values.