types.asciidoc 3.6 KB

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