| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 | [[mapping-types]]== Field data typesEach field has a _field data type_, or _field type_. This type indicates thekind of data the field contains, such as strings or boolean values, and itsintended use. For example, you can index strings to both `text` and `keyword`fields. However, `text` field values are <<analysis,analyzed>> for full-textsearch while `keyword` strings are left as-is for filtering and sorting.Field types are grouped by _family_. Types in the same family support the samesearch functionality but may have different space usage or performancecharacteristics.Currently, the only type family is `keyword`, which consists of the `keyword`,`constant_keyword`, and `wildcard` field types. Other type families have only asingle field type. For example, the `boolean` type family consists of one fieldtype: `boolean`.[discrete][[_core_datatypes]]==== Common types<<binary,`binary`>>::   Binary value encoded as a Base64 string.<<boolean,`boolean`>>:: `true` and `false` values.<<keyword, Keywords>>:: The keyword family, including `keyword`, `constant_keyword`,                        and `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`>>.<<field-alias,`alias`>>::     Defines an alias for an existing field.[discrete][[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.<<version,`version`>>::  Software versions. Supports https://semver.org/[Semantic Versioning]precedence rules.{plugins}/mapper-murmur3.html[`murmur3`]:: Compute and stores hashes ofvalues.[discrete][[aggregated-data-types]]==== Aggregate data types<<aggregate-metric-double,`aggregate_metric_double`>>:: Pre-aggregated metric values.<<histogram,`histogram`>>:: Pre-aggregated numerical values in the form of a histogram.[discrete][[text-search-types]]==== Text search types<<text,`text` fields>>:: The text family, including `text` and `match_only_text`.                         Analyzed, unstructured text.{plugins}/mapper-annotated-text.html[`annotated-text`]:: Text containing specialmarkup. Used for identifying named entities.<<completion-suggester,`completion`>>:: Used for auto-complete suggestions.<<search-as-you-type,`search_as_you_type`>>:: `text`-like type foras-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<<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<<percolator,`percolator`>>::   Indexes queries written in <<query-dsl,Query DSL>>.[discrete][[types-array-handling]]=== ArraysIn {es}, arrays do not require a dedicated field data type. Any field can containzero or more values by default, however, all values in the array must be of thesame field type. See <<array>>.[discrete][[types-multi-fields]]=== Multi-fieldsIt is often useful to index the same field in different ways for differentpurposes. For instance, a `string` field could be mapped asa `text` field for full-text search, and as a `keyword` field forsorting or aggregations. Alternatively, you could index a text field withthe <<analysis-standard-analyzer,`standard` analyzer>>, the<<english-analyzer,`english`>> analyzer, and the<<french-analyzer,`french` analyzer>>.This is the purpose of _multi-fields_. Most field types support multi-fieldsvia the <<multi-fields>> parameter.include::types/aggregate-metric-double.asciidoc[]include::types/alias.asciidoc[]include::types/array.asciidoc[]include::types/binary.asciidoc[]include::types/boolean.asciidoc[]include::types/date.asciidoc[]include::types/date_nanos.asciidoc[]include::types/dense-vector.asciidoc[]include::types/flattened.asciidoc[]include::types/geo-point.asciidoc[]include::types/geo-shape.asciidoc[]include::types/histogram.asciidoc[]include::types/ip.asciidoc[]include::types/parent-join.asciidoc[]include::types/keyword.asciidoc[]include::types/nested.asciidoc[]include::types/numeric.asciidoc[]include::types/object.asciidoc[]include::types/percolator.asciidoc[]include::types/point.asciidoc[]include::types/range.asciidoc[]include::types/rank-feature.asciidoc[]include::types/rank-features.asciidoc[]include::types/search-as-you-type.asciidoc[]include::types/shape.asciidoc[]include::types/text.asciidoc[]include::types/token-count.asciidoc[]include::types/unsigned_long.asciidoc[]include::types/version.asciidoc[]
 |