Using copy fields

Search supports the stored=false copy field directive in the schema.xml.

The way DSE Search/Solr handles copy fields depends on the value of the stored attribute.

If stored=false in the copyField directive:
  • Ingested data is copied by the copyField mechanism to the destination field for search, but data is not stored in Cassandra.
  • When you add a new copyField directive to the schema.xml, pre-existing and newly ingested data is re-indexed when copied as a result of the new directive.
If stored=true in the copyField directive:
  • Ingested data is copied by the copyField mechanism and data is stored in Cassandra.
  • When you add a new copyField directive to the schema.xml, pre-existing data is re-indexed as the result of an old copyField directive, but not when copied as the result of a new copyField directive. To be re-indexed, data must be re-ingested after you add a new copyField directive to the schema.
DataStax Enterprise 4.0.3 and later supports stored copy fields having different source and destination data types.

Using a copy field and multivalued field

When you use copy fields to copy multiple values into a field, CQL comes in handy because you do not need to format the data in json, for example, when you insert it. Using the Solr HTTP API update command, the data must be formatted.

Use the CQL BATCH command to insert column values in a single CQL statement to prevent overwriting. This process is consistent with Solr HTTP APIs, where all copied fields need to be present in the inserted document. You need to use BATCH to insert the column values whether or not the values are stored in Cassandra.

Using docValues and copy fields for faceting

Using docValues can improve performance of faceting, grouping, filtering, sorting, and other operations described on the Solr Wiki.

For faceting to use docValues, the schema needs to specify multiValued="true" even if the field is a single-value facet field. The field needs to include docValues="true". You also need to use a field type that supports being counted by Solr. The text type, which tokenizes values, cannot be used, but the string type works fine. DataStax Enterprise supports all aspects of copy fields except:
  • The maxChars attribute is not supported.
  • Copying from/to the same dynamic field is not supported.