search.asciidoc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. [discrete]
  2. [[breaking_80_search_changes]]
  3. ==== Search changes
  4. //NOTE: The notable-breaking-changes tagged regions are re-used in the
  5. //Installation and Upgrade Guide
  6. //tag::notable-breaking-changes[]
  7. [[_type-search-matches-no-docs]]
  8. .Searches on the `_type` field are no longer supported.
  9. [%collapsible]
  10. ====
  11. *Details* +
  12. In 8.x, the `_type` metadata field has been removed. {es} now handles a search
  13. on the `_type` field as a search on a non-existent field. A search on a
  14. non-existent field matches no documents, regardless of the query string.
  15. In 7.x, a search for `_doc` in the `_type` field would match the same documents
  16. as a `match_all` query.
  17. *Impact* +
  18. Remove queries on the `_type` field from your search requests and search
  19. templates. Searches that include these queries may return no results.
  20. ====
  21. [[msearch-empty-line-support]]
  22. .The multi search API now parses an empty first line as action metadata in text files.
  23. [%collapsible]
  24. ====
  25. *Details* +
  26. The multi search API now parses an empty first line as empty action metadata
  27. when you provide a text file as the request body, such as when using curl's
  28. `--data-binary` flag.
  29. The API no longer supports text files that contain:
  30. * An empty first line followed by a line containing only `{}`.
  31. * An empty first line followed by another empty line.
  32. *Impact* +
  33. Don't provide an unsupported text file to the multi search API. Requests that
  34. include an unsupported file will return an error.
  35. ====
  36. [[remove-unmapped-type-string]]
  37. .The `unmapped_type: string` sort option has been removed.
  38. [%collapsible]
  39. ====
  40. *Details* +
  41. Search requests no longer support the `unmapped_type: string` sort option.
  42. Instead, use `unmapped_type: keyword` to handle an unmapped field as if it had
  43. the `keyword` field type but ignore its values for sorting.
  44. *Impact* +
  45. Discontinue use of `unmapped_type: string`. Search requests that include the
  46. `unmapped_type: string` sort option will return shard failures.
  47. ====
  48. [[id-field-data]]
  49. .Aggregating and sorting on `_id` is disallowed by default.
  50. [%collapsible]
  51. ====
  52. *Details* +
  53. Previously, it was possible to aggregate and sort on the built-in `_id` field
  54. by loading an expensive data structure called fielddata. This was deprecated
  55. in 7.6 and is now disallowed by default in 8.0.
  56. *Impact* +
  57. Aggregating and sorting on `_id` should be avoided. As an alternative, the
  58. `_id` field's contents can be duplicated into another field with docvalues
  59. enabled (note that this does not apply to auto-generated IDs).
  60. ====
  61. [[max_clause_count_change]]
  62. .The `indices.query.bool.max_clause_count` setting now limits all query clauses.
  63. [%collapsible]
  64. ====
  65. *Details* +
  66. Previously, the `indices.query.bool.max_clause_count` would apply to the number
  67. of clauses of a single `bool` query. It now applies to the total number of
  68. clauses of the rewritten query. In order to reduce chances of breaks, its
  69. default value has been bumped from 1024 to 4096.
  70. *Impact* +
  71. Queries with many clauses should be avoided whenever possible. If you had bumped
  72. this setting already in order to accomodate for some heavy queries, you might
  73. need to bump it further so that these heavy queries keep working.
  74. ====
  75. .Search-related REST API endpoints containing mapping types have been removed.
  76. [%collapsible]
  77. ====
  78. *Details* +
  79. The `/{index}/{type}/_search`, `/{index}/{type}/_msearch`, `/{index}/{type}/_search/template` and `/{index}/{type}/_msearch/template` REST endpoints have been removed in favour of `/{index}/_search`, `/{index}/_msearch`, `/{index}/_search/template` and `/{index}/_msearch/template`; since indexes no longer contain types, these typed endpoints are obsolete..
  80. The `/{index}/{type}/_termvectors`, `/{index}/{type}/{id}/_termvectors` and `/{index}/{type}/_mtermvectors` REST endpoints have been removed in favour of `/{index}/_termvectors`, `/{index}/{id}/_termvectors` and `/{index}/_mtermvectors`; since indexes no longer contain types, these typed endpoints are obsolete..
  81. The `/{index}/{type}/{doc}` and `/{index}/{type}/_mget` REST endpoints have been removed in favour of `/{index}/_doc/{doc}` and `/{index}/_mget`; since indexes no longer contain types, these typed endpoints are obsolete.
  82. *Impact* +
  83. Use the replacement REST API endpoints. Requests submitted to API endpoints that
  84. contain a mapping type will return an error.
  85. ====
  86. .The `common` query has been removed.
  87. [%collapsible]
  88. ====
  89. *Details* +
  90. The `common` query, deprecated in 7.x, has been removed in 8.0.
  91. The same functionality can be achieved by the `match` query if the total number of hits is not tracked.
  92. *Impact* +
  93. Discontinue use of the `common` query. Search requests containing a `common`
  94. query will return an error.
  95. ====
  96. .The `cutoff_frequency` parameter has been removed from the `match` and `multi_match` query.
  97. [%collapsible]
  98. ====
  99. *Details* +
  100. The `cutoff_frequency` parameter, deprecated in 7.x, has been removed in 8.0 from `match` and `multi_match` queries.
  101. The same functionality can be achieved without any configuration provided that the total number of hits is not tracked.
  102. *Impact* +
  103. Discontinue use of the `cutoff_frequency` parameter. Search requests containing
  104. this parameter in a `match` or `multi_match` query will return an error.
  105. ====
  106. .The `nested_filter` and `nested_path` properties have been removed from the search API's `sort` request body parameter.
  107. [%collapsible]
  108. ====
  109. *Details* +
  110. The `nested_filter` and `nested_path` options, deprecated in 6.x, have been removed in favor of the `nested` context.
  111. *Impact* +
  112. Discontinue use of the `sort` request body parameter's `nested_filter` and
  113. `nested_path` properties. Requests containing these properties will return an
  114. error.
  115. ====
  116. .Search and get requests are now routed to shards using adaptive replica selection by default.
  117. [%collapsible]
  118. ====
  119. *Details* +
  120. {es} will no longer prefer using shards in the same location (with the same awareness attribute values) to process
  121. `_search` and `_get` requests. Adaptive replica selection (activated by default in this version) will route requests
  122. more efficiently using the service time of prior inter-node communications.
  123. *Impact* +
  124. No action needed.
  125. ====
  126. .The `sparse_vector` field data type has been removed.
  127. [%collapsible]
  128. ====
  129. *Details* +
  130. The `sparse_vector` field type was deprecated in 7.6 and is now removed in
  131. 8.0. We have not seen much interest in this experimental field type, and don't
  132. see a clear use case as it's currently designed. If you have feedback or
  133. suggestions around sparse vector functionality, please let us know through
  134. GitHub or the 'discuss' forums.
  135. *Impact* +
  136. Discontinue use of the `sparse_vector` field data type. Requests containing
  137. a mapping for this field data type will return an error.
  138. ====
  139. .Vector functions using `(query, doc['field'])` are no longer supported.
  140. [%collapsible]
  141. ====
  142. *Details* +
  143. The vector functions of the form `function(query, doc['field'])` were
  144. deprecated in 7.6, and are now removed in 8.x. The form
  145. `function(query, 'field')` should be used instead. For example,
  146. `cosineSimilarity(query, doc['field'])` is replaced by
  147. `cosineSimilarity(query, 'field')`.
  148. *Impact* +
  149. Use the `function(query, 'field')` form. Discontinue use of the `function(query,
  150. doc['field'])` form. Requests containing the `function(query,
  151. doc['field'])` form will return an error.
  152. ====
  153. .The search API's `indices_boost` request body parameter no longer accepts object values.
  154. [%collapsible]
  155. ====
  156. *Details* +
  157. The `indices_boost` option in the search request used to accept the boosts
  158. both as an object and as an array. The object format has been deprecated since
  159. 5.2 and is now removed in 8.0.
  160. *Impact* +
  161. Use only array values in the `indices_boost` parameter. Requests containing an
  162. object value in the `indices_boost` parameter will return an error.
  163. ====
  164. .The search API's `use_field_mapping` request body parameter has been removed.
  165. [%collapsible]
  166. ====
  167. *Details* +
  168. In 7.0, we began formatting `docvalue_fields` by default using each field's
  169. mapping definition. To ease the transition from 6.x, we added the format
  170. option `use_field_mapping`. This parameter was deprecated in 7.0, and is now
  171. removed in 8.0.
  172. *Impact* +
  173. Discontinue use of the `use_field_mapping` request body parameter. Requests
  174. containing this parameter will return an error.
  175. ====
  176. .The search API's `from` request body and url parameter cannot be negative.
  177. [%collapsible]
  178. ====
  179. *Details* +
  180. Search request used to accept `-1` as a `from` in the search body and the url,
  181. treating it as the default value of 0. Other negative values got rejected with
  182. an error already. We now also reject `-1` as an invalid value.
  183. *Impact* +
  184. Change any use of `-1` as `from` parameter in request body or url parameters by either
  185. setting it to `0` or omitting it entirely. Requests containing negative values will
  186. return an error.
  187. ====
  188. .Range queries on date fields treat numeric values alwas as milliseconds-since-epoch.
  189. [%collapsible]
  190. ====
  191. *Details* +
  192. Range queries on date fields used to misinterpret small numbers (e.g. four digits like 1000)
  193. as a year when no additional format was set, but would interpret other numeric values as
  194. milliseconds since epoch. We now treat all numeric values in absence of a specific `format`
  195. parameter as milliseconds since epoch. If you want to query for years instead, with a missing
  196. `format` you now need to quote the input value (e.g. "1984").
  197. *Impact* +
  198. If you query date fields without a specified `format`, check if the values in your queries are
  199. actually meant to be milliseconds-since-epoch and use a numeric value in this case. If not, use
  200. a string value which gets parsed by either the date format set on the field in the mappings or
  201. by `strict_date_optional_time` by default.
  202. ====
  203. .The `geo_bounding_box` query's `type` parameter has been removed.
  204. [%collapsible]
  205. ====
  206. *Details* +
  207. The `geo_bounding_box` query's `type` parameter was deprecated in 7.14.0 and has
  208. been removed in 8.0.0. This parameter is a no-op and has no effect on the query.
  209. *Impact* +
  210. Discontinue use of the `type` parameter. `geo_bounding_box` queries that include
  211. this parameter will return an error.
  212. ====
  213. .The `type` query has been removed.
  214. [%collapsible]
  215. ====
  216. *Details* +
  217. The `type` query has been removed. Mapping types have been removed in 8.0.
  218. *Impact* +
  219. Discontinue use of the `type` query. Requests that include the `type` query
  220. will return an error.
  221. ====
  222. //end::notable-breaking-changes[]