Field Type

What it is

A field type is the configuration template for a category of fields in a search index schema. It defines how values of that type are processed: what analysis chain to apply, whether to store the original value, whether to build a DocValues column, and what query types are supported.

Field types give schema designers a reusable abstraction: define a text_english type once with the appropriate analyzer, then assign it to every field that needs English full-text search.

How it works

In Solr’s schema.xml, a field type bundles:

<fieldType name="text_english" class="solr.TextField">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.StopFilterFactory" words="stopwords.txt"/>
    <filter class="solr.PorterStemFilterFactory"/>
  </analyzer>
</fieldType>

Fields then reference the type:

<field name="body" type="text_english" indexed="true" stored="true"/>
<field name="title" type="text_english" indexed="true" stored="true"/>

In Elasticsearch, the equivalent is the type field in mappings (text, keyword, integer, etc.) with optional analyzer and fields overrides. Elasticsearch does not have an explicit named field type registry — types are inline.

Common field type properties:

Property Controls
indexed Whether an inverted index is built (enables full-text search)
stored Whether the original value is retained for retrieval
docValues Whether a column-store is built (enables sorting, faceting, aggregations)
multiValued Whether the field can hold multiple values per document

Example

A product catalog might define:

Field Type Used for Key config
text_english Description, body text Standard tokeniser, lowercase, stop words, stemmer
keyword Brand, category No analysis — exact match only
text_ngram SKU, product codes N-gram tokeniser for partial matching
double Price Numeric, DocValues for range filters and sorting
date Release date Date parser, DocValues for range and sort

When to use it

Understanding field types matters when:

  • Designing a schema — choosing between text (analysed) and keyword (exact) is the most consequential schema decision in Elasticsearch. Mistracking the difference causes both false matches and missing results.
  • Adding sort/facet capabilities — if you need to sort or facet on a text field, you need either a sibling keyword sub-field or DocValues enabled.
  • Multi-language content — define separate field types per language (or use a language detection pipeline to route documents to language-specific fields).

See also