types.asciidoc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. [[mapping-types]]
  2. == Field data types
  3. Each field has a _field data type_, or _field type_. This type indicates the
  4. kind of data the field contains, such as strings or boolean values, and its
  5. intended use. For example, you can index strings to both `text` and `keyword`
  6. fields. However, `text` field values are <<analysis,analyzed>> for full-text
  7. search while `keyword` strings are left as-is for filtering and sorting.
  8. Field types are grouped by _family_. Types in the same family support the same
  9. search functionality but may have different space usage or performance
  10. characteristics.
  11. Currently, the only type family is `keyword`, which consists of the `keyword`,
  12. `constant_keyword`, and `wildcard` field types. Other type families have only a
  13. single field type. For example, the `boolean` type family consists of one field
  14. type: `boolean`.
  15. [discrete]
  16. [[_core_datatypes]]
  17. ==== Common types
  18. <<binary,`binary`>>:: Binary value encoded as a Base64 string.
  19. <<boolean,`boolean`>>:: `true` and `false` values.
  20. <<keyword, Keywords>>:: The keyword family, including `keyword`, `constant_keyword`,
  21. and `wildcard`.
  22. <<number,Numbers>>:: Numeric types, such as `long` and `double`, used to
  23. express amounts.
  24. Dates:: Date types, including <<date,`date`>> and
  25. <<date_nanos,`date_nanos`>>.
  26. <<alias,`alias`>>:: Defines an alias for an existing field.
  27. [discrete]
  28. [[object-types]]
  29. ==== Objects and relational types
  30. <<object,`object`>>:: A JSON object.
  31. <<flattened,`flattened`>>:: An entire JSON object as a single field value.
  32. <<nested,`nested`>>:: A JSON object that preserves the relationship
  33. between its subfields.
  34. <<parent-join,`join`>>:: Defines a parent/child relationship for documents
  35. in the same index.
  36. [discrete]
  37. [[structured-data-types]]
  38. ==== Structured data types
  39. <<range,Range>>:: Range types, such as `long_range`, `double_range`,
  40. `date_range`, and `ip_range`.
  41. <<ip,`ip`>>:: IPv4 and IPv6 addresses.
  42. <<version,`version`>>:: Software versions. Supports https://semver.org/[Semantic Versioning]
  43. precedence rules.
  44. {plugins}/mapper-murmur3.html[`murmur3`]:: Compute and stores hashes of
  45. values.
  46. [discrete]
  47. [[aggregated-data-types]]
  48. ==== Aggregate data types
  49. <<histogram,`histogram`>>:: Pre-aggregated numerical values.
  50. [discrete]
  51. [[text-search-types]]
  52. ==== Text search types
  53. <<text,`text`>>:: Analyzed, unstructured text.
  54. {plugins}/mapper-annotated-text.html[`annotated-text`]:: Text containing special
  55. markup. Used for identifying named entities.
  56. <<completion-suggester,`completion`>>:: Used for auto-complete suggestions.
  57. <<search-as-you-type,`search_as_you_type`>>:: `text`-like type for
  58. as-you-type completion.
  59. <<token-count,`token_count`>>:: A count of tokens in a text.
  60. [discrete]
  61. [[document-ranking-types]]
  62. ==== Document ranking types
  63. <<dense-vector,`dense_vector`>>:: Records dense vectors of float values.
  64. <<rank-feature,`rank_feature`>>:: Records a numeric feature to boost hits at
  65. query time.
  66. <<rank-features,`rank_features`>>:: Records numeric features to boost hits at
  67. query time.
  68. [discrete]
  69. [[spatial_datatypes]]
  70. ==== Spatial data types
  71. <<geo-point,`geo_point`>>:: Latitude and longitude points.
  72. <<geo-shape,`geo_shape`>>:: Complex shapes, such as polygons.
  73. <<point,`point`>>:: Arbitrary cartesian points.
  74. <<shape,`shape`>>:: Arbitrary cartesian geometries.
  75. [discrete]
  76. [[other-types]]
  77. ==== Other types
  78. <<percolator,`percolator`>>:: Indexes queries written in <<query-dsl,Query DSL>>.
  79. [discrete]
  80. [[types-array-handling]]
  81. === Arrays
  82. In {es}, arrays do not require a dedicated field data type. Any field can contain
  83. zero or more values by default, however, all values in the array must be of the
  84. same field type. See <<array>>.
  85. [discrete]
  86. === Multi-fields
  87. It is often useful to index the same field in different ways for different
  88. purposes. For instance, a `string` field could be mapped as
  89. a `text` field for full-text search, and as a `keyword` field for
  90. sorting or aggregations. Alternatively, you could index a text field with
  91. the <<analysis-standard-analyzer,`standard` analyzer>>, the
  92. <<english-analyzer,`english`>> analyzer, and the
  93. <<french-analyzer,`french` analyzer>>.
  94. This is the purpose of _multi-fields_. Most field types support multi-fields
  95. via the <<multi-fields>> parameter.
  96. include::types/alias.asciidoc[]
  97. include::types/array.asciidoc[]
  98. include::types/binary.asciidoc[]
  99. include::types/boolean.asciidoc[]
  100. include::types/date.asciidoc[]
  101. include::types/date_nanos.asciidoc[]
  102. include::types/dense-vector.asciidoc[]
  103. include::types/flattened.asciidoc[]
  104. include::types/geo-point.asciidoc[]
  105. include::types/geo-shape.asciidoc[]
  106. include::types/histogram.asciidoc[]
  107. include::types/ip.asciidoc[]
  108. include::types/parent-join.asciidoc[]
  109. include::types/keyword.asciidoc[]
  110. include::types/nested.asciidoc[]
  111. include::types/numeric.asciidoc[]
  112. include::types/object.asciidoc[]
  113. include::types/percolator.asciidoc[]
  114. include::types/point.asciidoc[]
  115. include::types/range.asciidoc[]
  116. include::types/rank-feature.asciidoc[]
  117. include::types/rank-features.asciidoc[]
  118. include::types/search-as-you-type.asciidoc[]
  119. include::types/shape.asciidoc[]
  120. include::types/text.asciidoc[]
  121. include::types/token-count.asciidoc[]
  122. include::types/unsigned_long.asciidoc[]
  123. include::types/version.asciidoc[]