站点图标 兰玉磊的个人博客

Elasticsearch7 Field data types

Each field has a field data type, or field type. This type indicates the kind of data the field contains, such as strings or boolean values, and its intended use. For example, you can index strings to both text and keyword fields. However, text field values are analyzed for full-text search while keyword strings are left as-is for filtering and sorting.

Field types are grouped by family. Types in the same family support the same search functionality but may have different space usage or performance characteristics.

Currently, the only type family is keyword, which consists of the keywordconstant_keyword, and wildcard field types. Other type families have only a single field type. For example, the boolean type family consists of one field type: boolean.

Common types

Objects and relational types

Structured data types

Aggregate data types

Text search types

Document ranking types

Spatial data types

Other types

Arrays

In Elasticsearch, arrays do not require a dedicated field data type. Any field can contain zero or more values by default, however, all values in the array must be of the same field type. See Arrays.

Multi-fields

It is often useful to index the same field in different ways for different purposes. For instance, a string field could be mapped as a text field for full-text search, and as a keyword field for sorting or aggregations. Alternatively, you could index a text field with the standard analyzer, the english analyzer, and the french analyzer.

This is the purpose of multi-fields. Most field types support multi-fields via the fields parameter.

退出移动版