Text datatype
editText datatype
editA field to index full-text values, such as the body of an email or the
description of a product. 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. Text fields are not
used for sorting and seldom used for aggregations (although the
significant text aggregation
is a notable exception).
If you need to index structured content such as email addresses, hostnames, status
codes, or tags, it is likely that you should rather use a keyword
field.
Below is an example of a mapping for a text field:
PUT my_index { "mappings": { "properties": { "full_name": { "type": "text" } } } }
Use a field as both text and keyword
editSometimes it is useful to have both a full text (text
) and a keyword
(keyword
) 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 text fields
editThe following parameters are accepted by text
fields:
The analyzer which should be used for
|
|
Mapping field-level query time boosting. Accepts a floating point number, defaults
to |
|
Should global ordinals be loaded eagerly on refresh? Accepts |
|
Can the field use in-memory fielddata for sorting, aggregations,
or scripting? Accepts |
|
Expert settings which allow to decide which values to load in memory when |
|
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. |
|
Should the field be searchable? Accepts |
|
What information should be stored in the index, for search and highlighting purposes.
Defaults to |
|
If enabled, term prefixes of between 2 and 5 characters are indexed into a separate field. This allows prefix searches to run more efficiently, at the expense of a larger index. |
|
If enabled, two-term word combinations (shingles) are indexed into a separate
field. This allows exact phrase queries (no slop) to run more efficiently, at the expense
of a larger index. Note that this works best when stopwords are not removed,
as phrases containing stopwords will not use the subsidiary field and will fall
back to a standard phrase query. Accepts |
|
Whether field-length should be taken into account when scoring queries.
Accepts |
|
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 |