WARNING: Version 2.3 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
String datatype
editString datatype
editFields of type string
accept text values. Strings may be sub-divided into:
- Full text
-
Full text values, like the body of an email, are typically used for text based relevance searches, such as: Find the most relevant documents that match a query for "quick brown fox".
These fields are
analyzed
, that is they are passed through an analyzer to convert the string into a list of individual terms before being indexed. The analysis process allows Elasticsearch to search for individual words within each full text field. Full text fields are not used for sorting and seldom used for aggregations (although the significant terms aggregation is a notable exception). - Keywords
-
Keywords are exact values like email addresses, hostnames, status codes, or
tags. They are typically used for filtering (Find me all blog posts where
status
ispublished
), for sorting, and for aggregations. Keyword fields arenot_analyzed
. Instead, the exact string value is added to the index as a single term.
Below is an example of a mapping for a full text (analyzed
) and a keyword
(not_analyzed
) string field:
PUT my_index { "mappings": { "my_type": { "properties": { "full_name": { "type": "string" }, "status": { "type": "string", "index": "not_analyzed" } } } } }
The |
|
The |
Sometimes it is useful to have both a full text (analyzed
) and a keyword
(not_analyzed
) version of the same field: one for full text search and the
other for aggregations and sorting. This can be achieved with
multi-fields.
Parameters for string fields
editThe following parameters are accepted by string
fields:
The analyzer which should be used for
|
|
Field-level index time boosting. Accepts a floating point number, defaults
to |
|
Should the field be stored on disk in a column-stride fashion, so that it
can later be used for sorting, aggregations, or scripting? Accepts |
|
Can the field use in-memory fielddata for sorting, aggregations,
or scripting? Accepts |
|
Multi-fields allow the same string value to be indexed in multiple ways for different purposes, such as one field for search and a multi-field for sorting and aggregations, or the same string value analyzed by different analyzers. |
|
Do not index or analyze any string longer than this value. Defaults to |
|
Whether or not the field value should be included in the
|
|
Should the field be searchable? Accepts |
|
What information should be stored in the index, for search and highlighting purposes.
Defaults to |
|
Whether field-length should be taken into account when scoring queries.
Defaults depend on the
|
|
Accepts a string value which is substituted for any explicit |
|
The number of fake term position which should be inserted between each
element of an array of strings. Defaults to the |
|
Whether the field value should be stored and retrievable separately from
the |
|
The |
|
The |
|
Which scoring algorithm or similarity should be used. Defaults
to |
|
Whether term vectors should be stored for an |