|
@@ -1,72 +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]
|
|
|
-[[spatial_datatypes]]
|
|
|
-=== Spatial data types
|
|
|
+[[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.
|
|
|
|
|
|
-<<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
|
|
|
+[[aggregated-data-types]]
|
|
|
+==== Aggregate data types
|
|
|
|
|
|
-<<ip>>:: `ip` for IPv4 and IPv6 addresses
|
|
|
-<<completion-suggester,Completion data type>>::
|
|
|
- `completion` to provide auto-complete suggestions
|
|
|
+<<histogram,`histogram`>>:: Pre-aggregated numerical values.
|
|
|
|
|
|
-<<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
|
|
|
+[discrete]
|
|
|
+[[text-search-types]]
|
|
|
+==== Text search types
|
|
|
|
|
|
-<<parent-join>>:: Defines parent/child relation for documents within the same index
|
|
|
+<<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.
|
|
|
|
|
|
-<<rank-feature>>:: Record numeric feature to boost hits at query time.
|
|
|
|
|
|
-<<rank-features>>:: Record numeric features to boost hits at query time.
|
|
|
+[discrete]
|
|
|
+[[document-ranking-types]]
|
|
|
+==== Document ranking types
|
|
|
|
|
|
-<<dense-vector>>:: Record dense vectors of float values.
|
|
|
+<<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.
|
|
|
|
|
|
-<<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.
|
|
|
+[discrete]
|
|
|
+[[spatial_datatypes]]
|
|
|
+==== Spatial data types
|
|
|
|
|
|
-<<flattened>>:: Allows an entire JSON object to be indexed as a single field.
|
|
|
+<<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.
|
|
|
+
|
|
|
+
|
|
|
+[discrete]
|
|
|
+[[other-types]]
|
|
|
+==== Other types
|
|
|
|
|
|
-<<histogram>>:: `histogram` for pre-aggregated numerical values for percentiles aggregations.
|
|
|
+<<percolator,`percolator`>>:: Indexes queries written in <<query-dsl,Query DSL>>.
|
|
|
|
|
|
-<<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
|
|
@@ -79,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[]
|