Defining index field types
Overview of the default search index fields definitions and field related schema modification syntax.
Default field type definitions
A field type definition is required for parsing CQL columns into the corresponding Solr field type. Add processing instructions to the analyzer section of the fieldType definition.
TrieField types
Used with a type attribute and value: integer, long, float, double, date.
- TrieDoubleField
-
<fieldType class="org.apache.solr.schema.TrieDoubleField" name="TrieDoubleField"/>
- TrieDateField
- Date field for 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.
<fieldType class="org.apache.solr.schema.TrieDateField" name="TrieDateField"/>
- TrieFloatField
-
<fieldType class="org.apache.solr.schema.TrieFloatField" name="TrieFloatField"/>
StringField types
- VarIntStrField
- Define with the DataStax class to convert a CQL varint.
<fieldType class="com.datastax.bdp.search.solr.core.types.VarIntStrField" name="VarIntStrField"/>
- AsciiStrField
- Converts a CQL ascii into a standard Solr
StrField.
<fieldType class="com.datastax.bdp.search.solr.core.types.AsciiStrField" name="AsciiStrField"/>
- SimpleDateField
- Define with the DataStax class to convert a CQL date field into a compatible Solr date
field.
<fieldType class="com.datastax.bdp.search.solr.core.types.SimpleDateField" name="SimpleDateField"/>
- BoolField
- Due to SOLR-7264, setting docValues to true on a boolean field in the Solr
schema does not work. A workaround for boolean docValues is to use 0 and 1 with a
TrieIntField.
<fieldType class="org.apache.solr.schema.BoolField" name="BoolField"/>
- BinaryField
-
<fieldType class="org.apache.solr.schema.BinaryField" name="BinaryField"/>
- UUIDField
- A value of this type is a Type 1 UUID that 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.
<fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>
Default index field definitions for CQL column types
Restriction: 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 these types.
CQL data type | Field type name | docValues | multiValued |
---|---|---|---|
ascii | AsciiStrField | false | false |
bigint | TrieLongField | true | false |
blob | BinaryField | not supported | false |
boolean | BoolField | false | false |
date | SimpleDateField | not supported | false |
decimal | DecimalStrField | false | false |
double | TrieDoubleField | true | false |
float | TrieFloatField | true | false |
inet | InetField | false | false |
int | TrieIntField | true | false |
smallint | TrieIntField | true | false |
text | TextField | false | false |
time | TimeField | true | false |
timestamp | TrieDateField | true | false |
timeuuid | TimeUUIDField | true | false |
tinyint | TrieIntField | true | false |
uuid | UUIDField | true | false |
varchar | TextField | not supported | false |
varint | VarIntStrField | false | false |
list | true | ||
map | true | ||
set | true | true | |
tuple/user defined type (UDT) | TupleField | false | false |
CQL data type compatibility with field type classes
CQL | Field name | Class | Description |
---|---|---|---|
ascii | AsciiStrField | AsciiType | Indexed as a standard Solr StrField. |
blob | BinaryField | BytesType | Binary data. |
boolean | BoolField | BooleanType | True (1, t, or T) or False (not 1, t, or T) |
DateRangeType | DateRangeField | DateRangeType | Point-in-time with millisecond precision with support for date ranges. See Using date ranges in solr_query. |
decimal | DecimalStrField | DecimalType | Indexed as a standard Solr StrField. |
text, varchar | EnumField | UTF8Type | A closed set with a pre-determined sort order. |
text, varchar | ExternalFileField | UTF8Type | Values from disk file. |
text, varchar | GeoHashField | UTF8Type | Hash of coordinate pair (latitude,longitude) stored as a string. |
inet | InetField | InetAddressType | InetField is implemented and indexed as a standard Solr StrField. |
text, varchar | LatLonType | UTF8Type | Latitude/Longitude 2-D point, latitude first. |
text, varchar | PointType | UTF8Type | Arbitrary n-dimensional point for spatial search. |
text, varchar | RandomSortField | UTF8Type | Dynamic field in random order. |
date | SimpleDateField | SimpleDateType | TrieDateField holding a CQL date. |
PointType | SpatialRecursivePrefixTreeFieldType | PointType | Spatial field type for a point geospatial context. |
text, varchar | SpatialRecursivePrefixTreeFieldType | UTF8Type | Spatial field type for a geospatial context. |
text, varchar | StrField | UTF8Type | String (UTF-8 encoded string or Unicode). |
text, varchar | TextField | UTF8Type | Text, usually multiple words or tokens. |
time | TimeField | TimeType | A TrieLongField holding a CQL time. |
timeuuid | TimeUUIDField | TimeUUIDType | Type 1 Universally Unique Identifier (UUID). |
timestamp | TrieDateField | DateType | Date field for Lucene TrieRange processing; supports indexing negative dates. |
double | TrieDoubleField | DoubleType | Double field for Lucene TrieRange processing. |
N/A | TrieField | N/A | Same as any Trie field type. |
float | TrieFloatField | FloatType | Floating point field for Lucene TrieRange processing. |
int, smallint | TrieIntField | Int32Type, ShortType | 32-bit signed integer field for Lucene TrieRange processing. |
tinyint | TrieIntField | ByteType | 32-bit signed integer field for Lucene TrieRange processing. |
bigint | TrieLongField | LongType | Long field for Lucene TrieRange processing. |
uuid, timeuuid | UUIDField | UUIDType | Universally Unique Identifier (UUID). |
varint | VarIntStrField | IntegerType | Indexed as a standard Solr StrField. |
text, varchar | Other | UTF8Type | Indexed as a standard Solr StrField. |