types.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [[mapping-types]]
  2. == Field data types
  3. Elasticsearch supports a number of different data types for the fields in a
  4. document:
  5. [discrete]
  6. [[_core_datatypes]]
  7. === Core data types
  8. string:: <<text,`text`>>, <<keyword,`keyword`>> and <<wildcard,`wildcard`>>
  9. <<number>>:: `long`, `integer`, `short`, `byte`, `double`, `float`, `half_float`, `scaled_float`
  10. <<date>>:: `date`
  11. <<date_nanos>>:: `date_nanos`
  12. <<boolean>>:: `boolean`
  13. <<binary>>:: `binary`
  14. <<range>>:: `integer_range`, `float_range`, `long_range`, `double_range`, `date_range`, `ip_range`
  15. [discrete]
  16. === Complex data types
  17. <<object>>:: `object` for single JSON objects
  18. <<nested>>:: `nested` for arrays of JSON objects
  19. [discrete]
  20. === Spatial data types
  21. <<geo-point>>:: `geo_point` for lat/lon points
  22. <<geo-shape>>:: `geo_shape` for complex shapes like polygons
  23. <<point>>:: `point` for arbitrary cartesian points.
  24. <<shape>>:: `shape` for arbitrary cartesian geometries.
  25. [discrete]
  26. === Specialised data types
  27. <<ip>>:: `ip` for IPv4 and IPv6 addresses
  28. <<completion-suggester,Completion data type>>::
  29. `completion` to provide auto-complete suggestions
  30. <<token-count>>:: `token_count` to count the number of tokens in a string
  31. {plugins}/mapper-murmur3.html[`mapper-murmur3`]:: `murmur3` to compute hashes of values at index-time and store them in the index
  32. {plugins}/mapper-annotated-text.html[`mapper-annotated-text`]:: `annotated-text` to index text containing special markup (typically used for identifying named entities)
  33. <<percolator>>:: Accepts queries from the query-dsl
  34. <<parent-join>>:: Defines parent/child relation for documents within the same index
  35. <<rank-feature>>:: Record numeric feature to boost hits at query time.
  36. <<rank-features>>:: Record numeric features to boost hits at query time.
  37. <<dense-vector>>:: Record dense vectors of float values.
  38. <<search-as-you-type>>:: A text-like field optimized for queries to implement as-you-type completion
  39. <<alias>>:: Defines an alias to an existing field.
  40. <<flattened>>:: Allows an entire JSON object to be indexed as a single field.
  41. <<histogram>>:: `histogram` for pre-aggregated numerical values for percentiles aggregations.
  42. <<constant-keyword>>:: Specialization of `keyword` for the case when all documents have the same value.
  43. [discrete]
  44. [[types-array-handling]]
  45. === Arrays
  46. In {es}, arrays do not require a dedicated field data type. Any field can contain
  47. zero or more values by default, however, all values in the array must be of the
  48. same data type. See <<array>>.
  49. [discrete]
  50. === Multi-fields
  51. It is often useful to index the same field in different ways for different
  52. purposes. For instance, a `string` field could be mapped as
  53. a `text` field for full-text search, and as a `keyword` field for
  54. sorting or aggregations. Alternatively, you could index a text field with
  55. the <<analysis-standard-analyzer,`standard` analyzer>>, the
  56. <<english-analyzer,`english`>> analyzer, and the
  57. <<french-analyzer,`french` analyzer>>.
  58. This is the purpose of _multi-fields_. Most data types support multi-fields
  59. via the <<multi-fields>> parameter.
  60. include::types/alias.asciidoc[]
  61. include::types/array.asciidoc[]
  62. include::types/binary.asciidoc[]
  63. include::types/boolean.asciidoc[]
  64. include::types/date.asciidoc[]
  65. include::types/date_nanos.asciidoc[]
  66. include::types/dense-vector.asciidoc[]
  67. include::types/histogram.asciidoc[]
  68. include::types/flattened.asciidoc[]
  69. include::types/geo-point.asciidoc[]
  70. include::types/geo-shape.asciidoc[]
  71. include::types/ip.asciidoc[]
  72. include::types/parent-join.asciidoc[]
  73. include::types/keyword.asciidoc[]
  74. include::types/nested.asciidoc[]
  75. include::types/numeric.asciidoc[]
  76. include::types/object.asciidoc[]
  77. include::types/percolator.asciidoc[]
  78. include::types/point.asciidoc[]
  79. include::types/range.asciidoc[]
  80. include::types/rank-feature.asciidoc[]
  81. include::types/rank-features.asciidoc[]
  82. include::types/search-as-you-type.asciidoc[]
  83. include::types/text.asciidoc[]
  84. include::types/token-count.asciidoc[]
  85. include::types/shape.asciidoc[]
  86. include::types/constant-keyword.asciidoc[]
  87. include::types/wildcard.asciidoc[]