Field types

This section documents the current Solr line (10.0; 9.10.x the maintained 9.x branch), written and verified against the Apache Solr Reference Guide. No specific patch version is pinned. Some capabilities (the Solr Operator on Kubernetes, the package-manager ecosystem, Learning To Rank model training, and expert plugin development) are linked, not documented in depth.

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

This section’s bibliography lists the reference material consulted while preparing these pages.

A Solr fieldType binds a name used in field definitions to a class — the Java implementation that stores and indexes values of that type — plus, for text-family types, the analyzer chain that turns raw input into indexed terms. Every field in the schema declares a type that must resolve to a fieldType defined in managed-schema. This page covers the field type classes you will actually use, the general and field-default properties every one of them accepts, and how an analyzer attaches to a type.

StrField and TextField

StrField stores a value as a single, unanalyzed, verbatim string — the Solr equivalent of Elasticsearch’s keyword. Use it for ids, tags, hostnames, and anything filtered on exactly or sorted on; it takes no <analyzer>.

TextField runs the value through an index analyzer (and, if different, a query analyzer) that tokenizes, lowercases, and often stems it into terms — the type behind full-text search. See Text analysis for the tokenizer/filter chain itself and Language analysis for language-specific stemming.

<!-- managed-schema -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true"/>

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

Change the schema over HTTP instead of hand-editing managed-schema with the Schema API’s add-field-type command:

curl -X POST -H 'Content-Type: application/json' \
  "http://localhost:8983/solr/books/schema" \
  -d '{
        "add-field-type": {
          "name": "text_general",
          "class": "solr.TextField",
          "positionIncrementGap": 100,
          "analyzer": {
            "tokenizer": { "class": "solr.StandardTokenizerFactory" },
            "filters": [ { "class": "solr.LowerCaseFilterFactory" } ]
          }
        }
      }'
# https://solr.apache.org/guide/solr/latest/indexing-guide/field-types-included-with-solr.html

Numeric fields: point-based types are current, Trie* is removed

Solr’s numeric and date field types are point-based: IntPointField, LongPointField, FloatPointField, DoublePointField, and DatePointField, all built on Lucene’s dimensional-point index structure. This is the only supported family of numeric field types — the older Trie* classes (TrieIntField, TrieLongField, TrieFloatField, TrieDoubleField, TrieDateField) have been removed from current Solr; a managed-schema that still declares one will fail to load. Any example, tutorial, or migration guide referring to a Trie* class is describing a pre-removal Solr version and needs the equivalent *PointField substituted.

<fieldType name="pint"    class="solr.IntPointField"    docValues="true"/>
<fieldType name="plong"   class="solr.LongPointField"   docValues="true"/>
<fieldType name="pfloat"  class="solr.FloatPointField"  docValues="true"/>
<fieldType name="pdouble" class="solr.DoublePointField" docValues="true"/>

Point fields are optimized for range queries and are compact on disk, but — unlike the old Trie fields — they carry no docValues by default and cannot be sorted, faceted, or used in function queries without them. Always set docValues="true" on a point field type (or on the individual field) if you will ever sort, facet, or stats on it; see Indexing internals & performance for what docValues costs and buys at index time. See Field Types Included with Solr for the full class list and Field Type Definitions and Properties for every property below.

curl --get "http://localhost:8983/solr/books/select" \
  --data-urlencode 'q=*:*' \
  --data-urlencode 'fq=year_i:[1960 TO 1979]' \
  --data-urlencode 'sort=year_i asc'

DatePointField and date math

DatePointField stores an instant with millisecond precision, always in UTC, formatted as ISO-8601 (1969-06-01T00:00:00Z, or a bare 1969-06-01 — Solr fills in midnight UTC). Queries and values accept date math: a base of a literal timestamp or NOW, followed by +/- offsets (+1DAY, -6MONTHS) and / rounding to a unit (/DAY, /YEAR).

# Everything published in the last 7 days, rounded to the start of today.
curl --get "http://localhost:8983/solr/books/select" \
  --data-urlencode 'q=*:*' \
  --data-urlencode 'fq=published_at:[NOW-7DAYS/DAY TO NOW/DAY+1DAY]'
# https://solr.apache.org/guide/solr/latest/query-guide/date-formatting-math.html

NOW resolves once per request and is cached per millisecond by default, which keeps fq clauses built from it reusable across the filter cache within the same request; pin it explicitly (NOW=<epoch_ms>) if a multi-request workflow needs the identical instant throughout. DateRangeField is a related, separate type for indexing date ranges (not just instants) with correct overlap semantics — see Field Types Included with Solr.

BoolField

Stores true/false (also accepted on input as T/F and 1/0). Sorts false before true.

<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<field name="in_stock" type="boolean" indexed="true" stored="true"/>

EnumFieldType

Encodes a fixed, ordered set of string values as their position in that order rather than lexicographically — so sorting EnumFieldType follows the enum’s declared order (LOW, MEDIUM, HIGH) instead of alphabetical order, and it takes less space than an equivalent string. The value set lives in a separate enumsConfig.xml, referenced from the field type by enumsConfig and enumName.

<fieldType name="severity" class="solr.EnumFieldType"
           enumsConfig="enumsConfig.xml" enumName="severityLevels" docValues="true"/>
<!-- enumsConfig.xml -->
<enumsConfig>
  <enum name="severityLevels">
    <value>LOW</value>
    <value>MEDIUM</value>
    <value>HIGH</value>
  </enum>
</enumsConfig>

Currency fields

CurrencyFieldType stores an amount together with a currency code ("19.99,USD"), and can convert between currencies at query time via a pluggable, configurable exchange-rate provider (a static rate file or an external rate service) so a range query in one currency correctly matches values stored in another.

<fieldType name="currency" class="solr.CurrencyFieldType"
           currencyConfig="currency.xml" defaultCurrency="USD"/>
<field name="price" type="currency" indexed="true" stored="true"/>
curl -X POST -H 'Content-Type: application/json' "http://localhost:8983/solr/books/update?commit=true" \
  -d '[ { "id": "1", "price": "19.99,USD" } ]'

curl --get "http://localhost:8983/solr/books/select" \
  --data-urlencode 'q=*:*' \
  --data-urlencode 'fq=price:[10,USD TO 30,USD]'
# https://solr.apache.org/guide/solr/latest/indexing-guide/field-types-included-with-solr.html

UUIDField

Stores a 128-bit UUID as a string. A field of this type left empty on input can be told to self-generate a value with <update><processor class="solr.UUIDUpdateProcessorFactory">, a common choice for a uniqueKey that clients should not have to invent.

<fieldType name="uuid" class="solr.UUIDField" indexed="true" stored="true"/>
<field name="id" type="uuid" indexed="true" stored="true" required="true"/>

Spatial fields

LatLonPointSpatialField is the current, recommended type for a plain latitude/longitude point — Lucene-backed, indexed with dimensional points like the numeric *PointField types above, and fast for both distance-sort and bounding-box/radius filters. Older spatial types (PointType, SpatialRecursivePrefixTreeFieldType, BBoxField) remain available for shapes or legacy schemas but are not the default choice for a point. See Spatial search for query syntax and Field Types Included with Solr for the full spatial type list.

<fieldType name="location" class="solr.LatLonPointSpatialField" docValues="true"/>
<field name="store_location" type="location" indexed="true" stored="true"/>
curl -X POST -H 'Content-Type: application/json' "http://localhost:8983/solr/stores/update?commit=true" \
  -d '[ { "id": "1", "store_location": "40.7128,-74.0060" } ]'

curl --get "http://localhost:8983/solr/stores/select" \
  --data-urlencode 'q=*:*' \
  --data-urlencode 'fq={!geofilt sfield=store_location pt=40.7,-74.0 d=10}'

Outside a [source] block, that same local-params filter is written escaped, as \{!geofilt sfield=store_location pt=40.7,-74.0 d=10}, so AsciiDoc does not try to interpret the braces.

DenseVectorField

Stores a fixed-length float (or byte) vector for k-nearest-neighbor search over embeddings — Solr’s counterpart to Elasticsearch’s dense_vector. The type declares the vector dimension and similarity function; a field of this type is queried with the knn query parser rather than a term or range query. See Dense vector search for indexing and query examples, and Query parsers for knn alongside Solr’s other parsers.

<fieldType name="knn_vector" class="solr.DenseVectorField"
           vectorDimension="384" similarityFunction="cosine"/>
<field name="embedding" type="knn_vector" indexed="true" stored="true"/>

Field type properties

Two layers of properties apply to a fieldType: a handful of type-level settings that only make sense on the fieldType element itself, and a larger set of field-default properties that a fieldType merely supplies a default for — any of them can be overridden per <field>. Full reference: Field Type Definitions and Properties.

Property Meaning

name

The identifier field definitions reference in their type attribute. Required.

class

The Java implementation class (solr.StrField, solr.IntPointField, …​). Required.

positionIncrementGap

For a multivalued TextField, the artificial gap between values so a phrase query cannot match across two separate entries.

docValuesFormat / postingsFormat

Overrides the on-disk codec used to store this type’s doc values / postings, for advanced tuning.

Field-default property Meaning

indexed

Whether values are searchable at all.

stored

Whether the original value is kept and returned in search results.

docValues

The columnar on-disk structure needed for sorting, faceting, and function queries — required on point fields for any of those, since (unlike the removed Trie types) they are not enabled by default.

multiValued

Whether the field accepts more than one value per document.

sortMissingFirst / sortMissingLast

Where documents lacking this field land when sorting on it.

omitNorms

Disables length-normalization scoring factors, saving space on a field never used for relevance ranking.

termVectors / termPositions / termOffsets

Store per-document term vector data, used by fast-vector highlighting and more-like-this.

required

Rejects an update that omits this field.

uninvertible

Whether Solr may build docValues-like data on the fly from the indexed terms of a field that lacks real docValues — a slow fallback, not a substitute for setting docValues="true".

<field name="title"     type="text_general" indexed="true" stored="true"/>
<field name="year_i"    type="pint"         indexed="true" stored="true" docValues="true"/>
<field name="tags_ss"   type="string"       indexed="true" stored="true" multiValued="true"/>
<field name="legacy_id" type="string"       indexed="false" stored="true" docValues="false"/>

Binding analyzers to a field type

Only text-family types (TextField and its SortableTextField variant) take an <analyzer>; StrField, the *PointField types, BoolField, EnumFieldType, CurrencyFieldType, UUIDField, and the spatial/vector types do not analyze their input at all — what is stored is, structurally, what was sent. Declare one <analyzer> for both index and query time, or split them with type="index" / type="query" when the two need to differ (a common case: index-time synonym expansion that must not also run at query time). Each <analyzer> chains exactly one <tokenizer> with zero or more <filter> stages. See Text analysis for the tokenizer/filter catalog and worked chains, and Language analysis for per-language stemmers and stop-word lists.

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
</fieldType>

A SolrJ client never needs to know the analyzer chain — it just sends and reads field values like any other client:

SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", "1");
doc.addField("title", "The Left Hand of Darkness");
doc.addField("year_i", 1969);
solrClient.add("books", doc);
solrClient.commit("books");

Continue with Schema & fields for how these types are assigned to fields (explicit fields, dynamic-field patterns, copyField, and uniqueKey), or Text analysis for a deeper look at the tokenizer/filter chain introduced above.