parent
8a6ecd5bfc
commit
462754e4e6
|
@ -1,74 +1,115 @@
|
|||
[[mapping-types]]
|
||||
== Field data types
|
||||
|
||||
Elasticsearch supports a number of different data types for the fields in a
|
||||
document:
|
||||
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 <<analysis,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 `keyword`,
|
||||
`constant_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`.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[_core_datatypes]]
|
||||
=== Core data types
|
||||
==== Common types
|
||||
|
||||
<<binary,`binary`>>:: Binary value encoded as a Base64 string.
|
||||
<<boolean,`boolean`>>:: `true` and `false` values.
|
||||
Keyword:: The keyword family, including <<keyword, `keyword`>>,
|
||||
<<constant-keyword,`constant_keyword`>>, and
|
||||
<<wildcard, `wildcard`>>.
|
||||
<<number,Numbers>>:: Numeric types, such as `long` and `double`, used to
|
||||
express amounts.
|
||||
Dates:: Date types, including <<date,`date`>> and
|
||||
<<date_nanos,`date_nanos`>>.
|
||||
<<alias,`alias`>>:: Defines an alias for an existing field.
|
||||
|
||||
string:: <<text,`text`>>, <<keyword,`keyword`>> and <<wildcard,`wildcard`>>
|
||||
<<number>>:: `long`, `integer`, `short`, `byte`, `double`, `float`, `half_float`, `scaled_float`
|
||||
<<date>>:: `date`
|
||||
<<date_nanos>>:: `date_nanos`
|
||||
<<boolean>>:: `boolean`
|
||||
<<binary>>:: `binary`
|
||||
<<range>>:: `integer_range`, `float_range`, `long_range`, `double_range`, `date_range`, `ip_range`
|
||||
|
||||
[discrete]
|
||||
=== Complex data types
|
||||
<<object>>:: `object` for single JSON objects
|
||||
<<nested>>:: `nested` for arrays of JSON objects
|
||||
[[object-types]]
|
||||
==== Objects and relational types
|
||||
|
||||
<<object,`object`>>:: A JSON object.
|
||||
<<flattened,`flattened`>>:: An entire JSON object as a single field value.
|
||||
<<nested,`nested`>>:: A JSON object that preserves the relationship
|
||||
between its subfields.
|
||||
<<parent-join,`join`>>:: Defines a parent/child relationship for documents
|
||||
in the same index.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[structured-data-types]]
|
||||
==== Structured data types
|
||||
|
||||
<<range,Range>>:: Range types, such as `long_range`, `double_range`,
|
||||
`date_range`, and `ip_range`.
|
||||
<<ip,`ip`>>:: IPv4 and IPv6 addresses.
|
||||
{plugins}/mapper-murmur3.html[`murmur3`]:: Compute and stores hashes of
|
||||
values.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[aggregated-data-types]]
|
||||
==== Aggregate data types
|
||||
|
||||
<<histogram,`histogram`>>:: Pre-aggregated numerical values.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[text-search-types]]
|
||||
==== Text search types
|
||||
|
||||
<<text,`text`>>:: Analyzed, unstructured text.
|
||||
{plugins}/mapper-annotated-text.html[`annotated-text`]:: Text containing special
|
||||
markup. Used for identifying named entities.
|
||||
<<completion-suggester,`completion`>>:: Used for auto-complete suggestions.
|
||||
<<search-as-you-type,`search_as_you_type`>>:: `text`-like type for
|
||||
as-you-type completion.
|
||||
<<token-count,`token_count`>>:: A count of tokens in a text.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[document-ranking-types]]
|
||||
==== Document ranking types
|
||||
|
||||
<<dense-vector,`dense_vector`>>:: Records dense vectors of float values.
|
||||
<<rank-feature,`rank_feature`>>:: Records a numeric feature to boost hits at
|
||||
query time.
|
||||
<<rank-features,`rank_features`>>:: Records numeric features to boost hits at
|
||||
query time.
|
||||
|
||||
|
||||
[discrete]
|
||||
[[spatial_datatypes]]
|
||||
=== Spatial data types
|
||||
==== Spatial data types
|
||||
|
||||
<<geo-point,`geo_point`>>:: Latitude and longitude points.
|
||||
<<geo-shape,`geo_shape`>>:: Complex shapes, such as polygons.
|
||||
<<point,`point`>>:: Arbitrary cartesian points.
|
||||
<<shape,`shape`>>:: Arbitrary cartesian geometries.
|
||||
|
||||
<<geo-point>>:: `geo_point` for lat/lon points
|
||||
<<geo-shape>>:: `geo_shape` for complex shapes like polygons
|
||||
<<point>>:: `point` for arbitrary cartesian points.
|
||||
<<shape>>:: `shape` for arbitrary cartesian geometries.
|
||||
|
||||
[discrete]
|
||||
=== Specialised data types
|
||||
[[other-types]]
|
||||
==== Other types
|
||||
|
||||
<<ip>>:: `ip` for IPv4 and IPv6 addresses
|
||||
<<completion-suggester,Completion data type>>::
|
||||
`completion` to provide auto-complete suggestions
|
||||
<<percolator,`percolator`>>:: Indexes queries written in <<query-dsl,Query DSL>>.
|
||||
|
||||
<<token-count>>:: `token_count` to count the number of tokens in a string
|
||||
{plugins}/mapper-murmur3.html[`mapper-murmur3`]:: `murmur3` to compute hashes of values at index-time and store them in the index
|
||||
{plugins}/mapper-annotated-text.html[`mapper-annotated-text`]:: `annotated-text` to index text containing special markup (typically used for identifying named entities)
|
||||
|
||||
<<percolator>>:: Accepts queries from the query-dsl
|
||||
|
||||
<<parent-join>>:: Defines parent/child relation for documents within the same index
|
||||
|
||||
<<rank-feature>>:: Record numeric feature to boost hits at query time.
|
||||
|
||||
<<rank-features>>:: Record numeric features to boost hits at query time.
|
||||
|
||||
<<dense-vector>>:: Record dense vectors of float values.
|
||||
|
||||
<<sparse-vector>>:: Record sparse vectors of float values.
|
||||
|
||||
<<search-as-you-type>>:: A text-like field optimized for queries to implement as-you-type completion
|
||||
|
||||
<<alias>>:: Defines an alias to an existing field.
|
||||
|
||||
<<flattened>>:: Allows an entire JSON object to be indexed as a single field.
|
||||
|
||||
<<histogram>>:: `histogram` for pre-aggregated numerical values for percentiles aggregations.
|
||||
|
||||
<<constant-keyword>>:: Specialization of `keyword` for the case when all documents have the same value.
|
||||
|
||||
[discrete]
|
||||
[[types-array-handling]]
|
||||
=== Arrays
|
||||
In {es}, 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 data type. See <<array>>.
|
||||
same field type. See <<array>>.
|
||||
|
||||
[discrete]
|
||||
=== Multi-fields
|
||||
|
@ -81,7 +122,7 @@ the <<analysis-standard-analyzer,`standard` analyzer>>, the
|
|||
<<english-analyzer,`english`>> analyzer, and the
|
||||
<<french-analyzer,`french` analyzer>>.
|
||||
|
||||
This is the purpose of _multi-fields_. Most data types support multi-fields
|
||||
This is the purpose of _multi-fields_. Most field types support multi-fields
|
||||
via the <<multi-fields>> parameter.
|
||||
|
||||
include::types/alias.asciidoc[]
|
||||
|
|
|
@ -76,10 +76,10 @@ query rewrites to `match_none` on every shard.
|
|||
|
||||
|
||||
The types used in the response describe _families_ of field types.
|
||||
Normally a family type is the same as the field type declared in the mapping,
|
||||
Normally a type family is the same as the field type declared in the mapping,
|
||||
but to simplify matters certain field types that behave identically are
|
||||
described using a family type. For example, `keyword`, `constant_keyword` and `wildcard`
|
||||
field types are all described as the `keyword` family type.
|
||||
described using a type family. For example, `keyword`, `constant_keyword` and `wildcard`
|
||||
field types are all described as the `keyword` type family.
|
||||
|
||||
|
||||
|
||||
|
@ -90,8 +90,8 @@ field types are all described as the `keyword` family type.
|
|||
Whether this field can be aggregated on all indices.
|
||||
|
||||
`indices`::
|
||||
The list of indices where this field has the same family type, or null if all indices
|
||||
have the same family type for the field.
|
||||
The list of indices where this field has the same type family, or null if all indices
|
||||
have the same type family for the field.
|
||||
|
||||
`non_searchable_indices`::
|
||||
The list of indices where this field is not searchable, or null if all indices
|
||||
|
|
Loading…
Reference in New Issue