mapping.asciidoc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. [[breaking_50_mapping_changes]]
  2. === Mapping changes
  3. ==== `string` fields replaced by `text`/`keyword` fields
  4. The `string` field datatype has been replaced by the `text` field for full
  5. text analyzed content, and the `keyword` field for not-analyzed exact string
  6. values. For backwards compatibility purposes, during the 5.x series:
  7. * `string` fields on pre-5.0 indices will function as before.
  8. * New `string` fields can be added to pre-5.0 indices as before.
  9. * `text` and `keyword` fields can also be added to pre-5.0 indices.
  10. * When adding a `string` field to a new index, the field mapping will be
  11. rewritten as a `text` or `keyword` field if possible, otherwise
  12. an exception will be thrown. Certain configurations that were possible
  13. with `string` fields are no longer possible with `text`/`keyword` fields
  14. such as enabling `term_vectors` on a not-analyzed `keyword` field.
  15. ==== Default string mappings
  16. String mappings now have the following default mappings:
  17. [source,json]
  18. ---------------
  19. {
  20. "type": "text",
  21. "fields": {
  22. "keyword": {
  23. "type": "keyword",
  24. "ignore_above": 256
  25. }
  26. }
  27. }
  28. ---------------
  29. This allows to perform full-text search on the original field name and to sort
  30. and run aggregations on the sub keyword field.
  31. ==== Numeric fields
  32. Numeric fields are now indexed with a completely different data-structure, called
  33. BKD tree, that is expected to require less disk space and be faster for range
  34. queries than the previous way that numerics were indexed.
  35. Term queries will return constant scores now, while they used to return higher
  36. scores for rare terms due to the contribution of the document frequency, which
  37. this new BKD structure does not record. If scoring is needed, then it is advised
  38. to map the numeric fields as <<keyword,`keyword`s>> too.
  39. Note that this <<keyword,`keyword`>> mapping do not need to replace the numeric
  40. mapping. For instance if you need both sorting and scoring on your numeric field,
  41. you could map it both as a number and a `keyword` using <<multi-fields>>:
  42. [source,js]
  43. --------------------------------------------------
  44. PUT my_index
  45. {
  46. "mappings": {
  47. "my_type": {
  48. "properties": {
  49. "my_number": {
  50. "type": "long",
  51. "fields": {
  52. "keyword": {
  53. "type": "keyword"
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. --------------------------------------------------
  62. // AUTOSENSE
  63. Also the `precision_step` parameter is now irrelevant and will be rejected on
  64. indices that are created on or after 5.0.
  65. ==== `index` property
  66. On all field datatypes (except for the deprecated `string` field), the `index`
  67. property now only accepts `true`/`false` instead of `not_analyzed`/`no`. The
  68. `string` field still accepts `analyzed`/`not_analyzed`/`no`.
  69. ==== Doc values on unindexed fields
  70. Previously, setting a field to `index:no` would also disable doc-values. Now,
  71. doc-values are always enabled on numeric and boolean fields unless
  72. `doc_values` is set to `false`.
  73. ==== Floating points use `float` instead of `double`
  74. When dynamically mapping a field containing a floating point number, the field
  75. now defaults to using `float` instead of `double`. The reasoning is that
  76. floats should be more than enough for most cases but would decrease storage
  77. requirements significantly.
  78. ==== `norms`
  79. `norms` now take a boolean instead of an object. This boolean is the replacement
  80. for `norms.enabled`. There is no replacement for `norms.loading` since eager
  81. loading of norms is not useful anymore now that norms are disk-based.
  82. ==== `fielddata.format`
  83. Setting `fielddata.format: doc_values` in the mappings used to implicitly
  84. enable doc-values on a field. This no longer works: the only way to enable or
  85. disable doc-values is by using the `doc_values` property of mappings.
  86. ==== `fielddata.filter.regex`
  87. Regex filters are not supported anymore and will be dropped on upgrade.
  88. ==== Source-transform removed
  89. The source `transform` feature has been removed. Instead, use an ingest pipeline
  90. ==== `_parent` field no longer indexed
  91. The join between parent and child documents no longer relies on indexed fields
  92. and therefore from 5.0.0 onwards the `_parent` field is no longer indexed. In
  93. order to find documents that refer to a specific parent id, the new
  94. `parent_id` query can be used. The GET response and hits inside the search
  95. response still include the parent id under the `_parent` key.
  96. ==== Source `format` option
  97. The `_source` mapping no longer supports the `format` option. It will still be
  98. accepted for indices created before the upgrade to 5.0 for backwards
  99. compatibility, but it will have no effect. Indices created on or after 5.0
  100. will reject this option.
  101. ==== Object notation
  102. Core types no longer support the object notation, which was used to provide
  103. per document boosts as follows:
  104. [source,json]
  105. ---------------
  106. {
  107. "value": "field_value",
  108. "boost": 42
  109. }
  110. ---------------
  111. ==== Boost accuracy for queries on `_all`
  112. Per-field boosts on the `_all` are now compressed into a single byte instead
  113. of the 4 bytes used previously. While this will make the index much more
  114. space-efficient, it also means that index time boosts will be less accurately
  115. encoded.