Search index schema field types and classes
CQL data is parsed into DSE Search indexes using a corresponding Solr field type. The index schema for each table must contain the Solr field type definition along with optional advanced processing instructions.
DSE Search index schemas define the CQL to Apache Solr™ type mapping.
A field type definition is required to parse data from a CQL column into the corresponding Solr field in the index.
The fieldType definitions support processing instructions in the analyzer section.
Decimal and varint limitations
Decimal and varint are indexed as strings. Apache Lucene™ does not support the precision required by these numeric types. Range and sorting queries do not work as expected if a table uses the decimal and varint types; equality searches work as expected.
Trie field types
- TrieDateField
-
Date field for Apache Lucene™ TrieRange processing, supports indexing negative date. For example: -28011-12-02T00:00:00.002Z. To insert negative dates for the CQL timestamp, insert an epoch time in milliseconds. The TimestampType does not accept a textual representation of negative dates.
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TrieDateField', @name='TrieDateField'];Results in the following schema XML:
<fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/> - TrieDoubleField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TrieDoubleField', @name='TrieDoubleField'];Results in the following schema XML:
<fieldType class="org.apache.solr.schema.TrieDoubleField" name="TrieDoubleField"/> - TrieFloatField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TrieFloatField', @name='TrieFloatField'];Results in the following schema XML:
<fieldType class="org.apache.solr.schema.TrieFloatField" name="TrieFloatField"/> - TrieIntField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TrieIntField', @name='TrieIntField'];Results in the following schema XML:
<fieldType class="org.apache.solr.schema.TrieIntField" name="TrieIntField"/> - TrieLongField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TrieLongField', @name='TrieLongField'];Results in the following schema XML:
<fieldType class="org.apache.solr.schema.TrieLongField" name="TrieLongField"/>
String field types
- AsciiStrField
-
Converts a CQL ascii into a standard Solr StrField.
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.AsciiStrField', @name='AsciiStrField'];Results in the following Schema XML:
<fieldType class="com.datastax.bdp.search.solr.core.types.AsciiStrField" name="AsciiStrField"/> - VarIntStrField
-
Define with the DataStax class to convert a CQL varint.
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.VarIntStrField', @name='VarIntStrField'];Results in the following schema XML:
<fieldType class="com.datastax.bdp.search.solr.core.types.VarIntStrField" name="VarIntStrField"/> - BinaryField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.BinaryField', @name='BinaryField'];Results in the following Schema XML:
<fieldType class="org.apache.solr.schema.BinaryField" name="BinaryField"/> - BoolField
ALTER SEARCH INDEX SCHEMA ON <table_name>
ADD types.fieldType[@class='org.apache.solr.schema.BoolField', @name='BoolField'];
+ Results in the following Schema XML:
+
<fieldType class="org.apache.solr.schema.BoolField" name="BoolField"/>
- SimpleDateField
-
Define with the DataStax class to convert a CQL date field into a compatible Solr date field.
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='com.datastax.bdp.search.solr.core.types.SimpleDateField', @name='SimpleDateField'];Results in the following Schema XML:
<fieldType class="com.datastax.bdp.search.solr.core.types.SimpleDateField" name="SimpleDateField"/> - TextField
-
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.TextField', @name='TextField'];To perform searches containing wildcard characters like % in TextField data, do not use the Lucene StandardAnalyzer class. Instead, define the tokenizer and filters for use in a multiterm search.
- UUIDField
-
UUIDField is a type 1 UUID data type, which includes the time of its generation. Values are sorted by conflict-free timestamps. For example, use the TimeUUID type to identify a column, such as a blog entry, by its timestamp and allow multiple clients to write to the same partition key simultaneously. To find data mapped from a TimeUUID to a UUIDField, search for the entire UUID value, not just its time component.
ALTER SEARCH INDEX SCHEMA ON <table_name> ADD types.fieldType[@class='org.apache.solr.schema.UUIDField', @name='UUIDField'];Results in the following Schema XML:
<fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>
CQL data type compatibility with Solr field type classes
DSE Search index schema defines the Solr field type of each indexed CQL column. The default mapping provides support for the most common use cases. To perform more advanced searches or a different type of analysis on a column, use the following compatibility matrix to determine the supported CQL data types to Solr types mappings.
|
Because collection types contain elements of specific types, they aren’t directly mapped.
The |
| CQL data type | Solr field type | Supports docValues | Description |
|---|---|---|---|
ascii |
AsciiStrField |
false |
Indexed as a standard Solr StrField. |
bigint |
TrieLongField |
true |
Long field for Lucene TrieRange processing. |
blob |
BinaryField |
not supported |
Binary data. |
boolean |
BoolField |
false |
True (1, t, or T) or False (not 1, t, or T) |
counter |
not indexable |
N/A |
64-bit signed integer. |
date |
SimpleDateField (DataStax custom field) |
not supported |
TrieDateField holding a CQL date. |
DateRangeType |
DateRangeField |
not supported |
Point-in-time with millisecond precision with support for date ranges. See Using date ranges in solr_query. |
decimal |
DecimalStrField |
false |
Indexed as a standard Solr StrField. |
double |
TrieDoubleField |
true |
Double field for Lucene TrieRange processing. |
DseExecutorState |
not indexable |
N/A |
Reserved data type for Apache Spark™. |
duration |
not indexable |
N/A |
Range of time, such as 12h30m. |
text, varchar |
EnumField |
not supported |
A closed set with a pre-determined sort order. |
text, varchar |
ExternalFileField |
not supported |
Values from disk file. |
float |
TrieFloatField |
true |
Floating point field for Lucene TrieRange processing. |
text, varchar |
GeoHashField |
not supported |
Hash of coordinate pair (latitude,longitude) stored as a string. |
inet |
InetField |
false |
InetField is implemented and indexed as a standard Solr StrField. |
int |
TrieIntField |
true |
32-bit signed integer field for Lucene TrieRange processing. |
text, varchar |
LatLonType |
not supported |
Latitude/Longitude 2-D point, latitude first. |
text, varchar |
LowerCaseStrField |
true |
Recommended method for case-insensitive text search, faceting, grouping, and sorting. Sets field values as lowercase and stores them as lowercase in docValues. See Using LowerCaseStrField with search indexes. |
LineStringType |
SpatialRecursivePrefixTreeFieldType |
true |
Spatial field type for a point geospatial context. |
PointType |
SpatialRecursivePrefixTreeFieldType |
true |
Spatial field type for a point geospatial context. |
text, varchar |
PointType |
Coordinate values, two per point for spatial search. |
|
PolygonType |
SpatialRecursivePrefixTreeFieldType |
true |
Spatial field type for a point geospatial context. |
text, varchar |
RandomSortField |
not supported |
Dynamic field in random order. |
text, varchar |
SpatialRecursivePrefixTreeFieldType |
Spatial field type for a geospatial context. |
|
smallint |
TrieIntField |
true |
32-bit signed integer field for Lucene TrieRange processing. |
text, varchar |
StrField |
false |
String (UTF-8 encoded string or Unicode). |
text |
TextField |
false |
Text, usually multiple words or tokens. |
time |
TimeField |
true |
A TrieLongField holding a CQL time. |
timestamp |
TrieDateField |
true |
Date field for Lucene TrieRange processing; supports indexing negative dates. |
timeuuid |
TimeUUIDField |
true |
Type 1 Universally Unique Identifier (UUID). |
N/A |
TrieField |
true |
Same as any Trie field type. |
tinyint |
TrieIntField |
true |
32-bit signed integer field for Lucene TrieRange processing. |
tuple |
TupleField |
false |
Fixed length set of elements of different types. |
user defined type (UDT) |
TupleField |
false |
User-defined type. |
uuid |
UUIDField |
true |
Universally Unique Identifier (UUID). |
varchar |
TextField |
not supported |
Text, usually multiple words or tokens. |
varint |
VarIntStrField |
false |
Indexed as a standard Solr StrField. |