search.asciidoc 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. [[breaking_50_search_changes]]
  2. === Search and Query DSL changes
  3. ==== `search_type`
  4. ===== `search_type=count` removed
  5. The `count` search type was deprecated since version 2.0.0 and is now removed.
  6. In order to get the same benefits, you just need to set the value of the `size`
  7. parameter to `0`.
  8. For instance, the following request:
  9. [source,sh]
  10. ---------------
  11. GET /my_index/_search?search_type=count
  12. {
  13. "aggs": {
  14. "my_terms": {
  15. "terms": {
  16. "field": "foo"
  17. }
  18. }
  19. }
  20. }
  21. ---------------
  22. can be replaced with:
  23. [source,sh]
  24. ---------------
  25. GET /my_index/_search
  26. {
  27. "size": 0,
  28. "aggs": {
  29. "my_terms": {
  30. "terms": {
  31. "field": "foo"
  32. }
  33. }
  34. }
  35. }
  36. ---------------
  37. ===== `search_type=scan` removed
  38. The `scan` search type was deprecated since version 2.1.0 and is now removed.
  39. All benefits from this search type can now be achieved by doing a scroll
  40. request that sorts documents in `_doc` order, for instance:
  41. [source,sh]
  42. ---------------
  43. GET /my_index/_search?scroll=2m
  44. {
  45. "sort": [
  46. "_doc"
  47. ]
  48. }
  49. ---------------
  50. Scroll requests sorted by `_doc` have been optimized to more efficiently resume
  51. from where the previous request stopped, so this will have the same performance
  52. characteristics as the former `scan` search type.
  53. ==== `fields` parameter
  54. The `fields` parameter has been replaced by `stored_fields`.
  55. The `stored_fields` parameter will only return stored fields
  56. -- it will no longer extract values from the `_source`.
  57. ==== `fielddata_fields` parameter
  58. The `fielddata_fields` has been deprecated, use parameter `docvalue_fields` instead.
  59. ==== search-exists API removed
  60. The search exists api has been removed in favour of using the search api with
  61. `size` set to `0` and `terminate_after` set to `1`.
  62. ==== Deprecated queries removed
  63. The following deprecated queries have been removed:
  64. `filtered`:: Use `bool` query instead, which supports `filter` clauses too.
  65. `and`:: Use `must` clauses in a `bool` query instead.
  66. `or`:: Use `should` clauses in a `bool` query instead.
  67. `limit`:: Use the `terminate_after` parameter instead.
  68. `fquery`:: Is obsolete after filters and queries have been merged.
  69. `query`:: Is obsolete after filters and queries have been merged.
  70. `query_binary`:: Was undocumented and has been removed.
  71. `filter_binary`:: Was undocumented and has been removed.
  72. ==== Changes to queries
  73. * Unsupported queries such as term queries on `geo_point` fields will now fail
  74. rather than returning no hits.
  75. * Removed support for fuzzy queries on numeric, date and ip fields, use range
  76. queries instead.
  77. * Removed support for range and prefix queries on `_uid` and `_id` fields.
  78. * Querying an unindexed field will now fail rather than returning no hits.
  79. * Removed support for the deprecated `min_similarity` parameter in `fuzzy
  80. query`, in favour of `fuzziness`.
  81. * Removed support for the deprecated `fuzzy_min_sim` parameter in
  82. `query_string` query, in favour of `fuzziness`.
  83. * Removed support for the deprecated `edit_distance` parameter in completion
  84. suggester, in favour of `fuzziness`.
  85. * Removed support for the deprecated `filter` and `no_match_filter` fields in `indices` query,
  86. in favour of `query` and `no_match_query`.
  87. * Removed support for the deprecated `filter` fields in `nested` query, in favour of `query`.
  88. * Removed support for the deprecated `minimum_should_match` and
  89. `disable_coord` in `terms` query, use `bool` query instead. Also removed
  90. support for the deprecated `execution` parameter.
  91. * Removed support for the top level `filter` element in `function_score` query, replaced by `query`.
  92. * The `collect_payloads` parameter of the `span_near` query has been deprecated. Payloads will be loaded when needed.
  93. * The `score_type` parameter to the `nested` and `has_child` queries has been
  94. removed in favour of `score_mode`. The `score_mode` parameter to `has_parent`
  95. has been deprecated in favour of the `score` boolean parameter. Also, the
  96. `total` score mode has been removed in favour of the `sum` mode.
  97. * When the `max_children` parameter was set to `0` on the `has_child` query
  98. then there was no upper limit on how many child documents were allowed to
  99. match. Now, `0` really means that zero child documents are allowed. If no
  100. upper limit is needed then the `max_children` parameter shouldn't be specified
  101. at all.
  102. * The `exists` query will now fail if the `_field_names` field is disabled.
  103. * The `multi_match` query will fail if `fuzziness` is used for `cross_fields`, `phrase` or `phrase_prefix` type.
  104. This parameter was undocumented and silently ignored before for these types of `multi_match`.
  105. * Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoPolygonQuery. Use parameter validation_method instead.
  106. * Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoDistanceRangeQuery. Use parameter validation_method instead.
  107. * Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoDistanceQuery. Use parameter validation_method instead.
  108. * Deprecated support for the coerce, normalize, ignore_malformed parameters in GeoBoundingBoxQuery. Use parameter validation_method instead.
  109. ==== Top level `filter` parameter
  110. Removed support for the deprecated top level `filter` in the search api,
  111. replaced by `post_filter`.
  112. ==== Highlighters
  113. Removed support for multiple highlighter names, the only supported ones are:
  114. `plain`, `fvh` and `postings`.
  115. ==== Term vectors API
  116. The term vectors APIs no longer persist unmapped fields in the mappings.
  117. The `dfs` parameter to the term vectors API has been removed completely. Term
  118. vectors don't support distributed document frequencies anymore.
  119. ==== Sort
  120. The `reverse` parameter has been removed, in favour of explicitly
  121. specifying the sort order with the `order` option.
  122. The `coerce` and `ignore_malformed` parameters were deprecated in favour of `validation_method`.
  123. ==== Inner hits
  124. * Top level inner hits syntax has been removed. Inner hits can now only be specified as part of the `nested`,
  125. `has_child` and `has_parent` queries. Use cases previously only possible with top level inner hits can now be done
  126. with inner hits defined inside the query dsl.
  127. * Source filtering for inner hits inside nested queries requires full field names instead of relative field names.
  128. This is now consistent for source filtering on other places in the search API.
  129. * Nested inner hits will now no longer include `_index`, `_type` and `_id` keys. For nested inner hits these values
  130. are always the same as the `_index`, `_type` and `_id` keys of the root search hit.
  131. * Parent/child inner hits will now no longer include the `_index` key. For parent/child inner hits the `_index` key is
  132. always the same as the the parent search hit.
  133. ==== Query Profiler
  134. In the response for profiling queries, the `query_type` has been renamed to `type` and `lucene` has been renamed to
  135. `description`. These changes have been made so the response format is more friendly to supporting other types of profiling
  136. in the future.
  137. ==== Search preferences
  138. The <<search-request-preference,search preference>> `_only_node` has
  139. been removed. The same behavior can be achieved by using `_only_nodes`
  140. and specifying a single node ID.
  141. The <<search-request-preference,search preference>> `_prefer_node` has
  142. been superseded by `_prefer_nodes`. By specifying a single node,
  143. `_prefer_nodes` provides the same functionality as `_prefer_node` but
  144. also supports specifying multiple nodes.
  145. ==== Default similarity
  146. The default similarity has been changed to `BM25`.