2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-09-07 11:25:05 -04:00
|
|
|
[[breaking_70_search_changes]]
|
2017-10-11 09:31:48 -04:00
|
|
|
=== Search and Query DSL changes
|
|
|
|
|
2019-04-08 21:54:29 -04:00
|
|
|
//NOTE: The notable-breaking-changes tagged regions are re-used in the
|
|
|
|
//Installation and Upgrade Guide
|
|
|
|
|
|
|
|
//tag::notable-breaking-changes[]
|
|
|
|
|
|
|
|
// end::notable-breaking-changes[]
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-03-12 05:16:41 -04:00
|
|
|
==== Off-heap terms index
|
|
|
|
|
|
|
|
The terms dictionary is the part of the inverted index that records all terms
|
|
|
|
that occur within a segment in sorted order. In order to provide fast retrieval,
|
|
|
|
terms dictionaries come with a small terms index that allows for efficient
|
|
|
|
random access by term. Until now this terms index had always been loaded
|
|
|
|
on-heap.
|
|
|
|
|
|
|
|
As of 7.0, the terms index is loaded on-heap for fields that only have unique
|
|
|
|
values such as `_id` fields, and off-heap otherwise - likely most other fields.
|
|
|
|
This is expected to reduce memory requirements but might slow down search
|
|
|
|
requests if both below conditions are met:
|
|
|
|
|
|
|
|
* The size of the data directory on each node is significantly larger than the
|
|
|
|
amount of memory that is available to the filesystem cache.
|
|
|
|
|
|
|
|
* The number of matches of the query is not several orders of magnitude greater
|
|
|
|
than the number of terms that the query tries to match, either explicitly via
|
|
|
|
`term` or `terms` queries, or implicitly via multi-term queries such as
|
|
|
|
`prefix`, `wildcard` or `fuzzy` queries.
|
|
|
|
|
|
|
|
This change affects both existing indices created with Elasticsearch 6.x and new
|
|
|
|
indices created with Elasticsearch 7.x.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-10-11 09:31:48 -04:00
|
|
|
==== Changes to queries
|
|
|
|
* The default value for `transpositions` parameter of `fuzzy` query
|
|
|
|
has been changed to `true`.
|
2017-09-07 11:25:05 -04:00
|
|
|
|
2018-03-22 13:37:08 -04:00
|
|
|
* The `query_string` options `use_dismax`, `split_on_whitespace`,
|
|
|
|
`all_fields`, `locale`, `auto_generate_phrase_query` and
|
|
|
|
`lowercase_expanded_terms` deprecated in 6.x have been removed.
|
|
|
|
|
2018-04-10 08:31:06 -04:00
|
|
|
* Purely negative queries (only MUST_NOT clauses) now return a score of `0`
|
|
|
|
rather than `1`.
|
|
|
|
|
2018-05-24 14:46:15 -04:00
|
|
|
* The boundary specified using geohashes in the `geo_bounding_box` query
|
|
|
|
now include entire geohash cell, instead of just geohash center.
|
|
|
|
|
2018-06-04 14:12:45 -04:00
|
|
|
* Attempts to generate multi-term phrase queries against non-text fields
|
2018-11-26 12:15:59 -05:00
|
|
|
with a custom analyzer will now throw an exception.
|
2018-06-04 14:12:45 -04:00
|
|
|
|
2020-07-29 09:16:29 -04:00
|
|
|
* An `envelope` crossing the dateline in a `geo_shape` query is now processed
|
2018-10-19 13:53:54 -04:00
|
|
|
correctly when specified using REST API instead of having its left and
|
|
|
|
right corners flipped.
|
|
|
|
|
2018-11-26 12:15:59 -05:00
|
|
|
* Attempts to set `boost` on inner span queries will now throw a parsing exception.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-09-07 11:25:05 -04:00
|
|
|
==== Adaptive replica selection enabled by default
|
|
|
|
|
|
|
|
Adaptive replica selection has been enabled by default. If you wish to return to
|
|
|
|
the older round robin of search requests, you can use the
|
|
|
|
`cluster.routing.use_adaptive_replica_selection` setting:
|
|
|
|
|
2019-09-13 11:23:53 -04:00
|
|
|
[source,console]
|
2017-09-07 11:25:05 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
PUT /_cluster/settings
|
|
|
|
{
|
2020-07-22 15:57:49 -04:00
|
|
|
"transient": {
|
|
|
|
"cluster.routing.use_adaptive_replica_selection": false
|
|
|
|
}
|
2017-09-07 11:25:05 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2019-09-13 11:23:53 -04:00
|
|
|
|
2017-09-07 11:25:05 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[search-api-returns-400-invalid-requests]]
|
2017-10-31 07:36:00 -04:00
|
|
|
==== Search API returns `400` for invalid requests
|
2017-10-31 07:17:27 -04:00
|
|
|
|
2017-10-31 07:36:00 -04:00
|
|
|
The Search API returns `400 - Bad request` while it would previously return
|
|
|
|
`500 - Internal Server Error` in the following cases of invalid request:
|
|
|
|
|
|
|
|
* the result window is too large
|
|
|
|
* sort is used in combination with rescore
|
|
|
|
* the rescore window is too large
|
|
|
|
* the number of slices is too large
|
|
|
|
* keep alive for scroll is too large
|
|
|
|
* number of filters in the adjacency matrix aggregation is too large
|
2018-05-30 08:00:07 -04:00
|
|
|
* script compilation errors
|
2017-11-10 10:02:06 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[scroll-queries-cannot-use-request-cache]]
|
2017-12-11 07:16:04 -05:00
|
|
|
==== Scroll queries cannot use the `request_cache` anymore
|
2017-11-10 10:02:06 -05:00
|
|
|
|
2017-12-11 07:16:04 -05:00
|
|
|
Setting `request_cache:true` on a query that creates a scroll (`scroll=1m`)
|
2017-11-10 10:02:06 -05:00
|
|
|
has been deprecated in 6 and will now return a `400 - Bad request`.
|
|
|
|
Scroll queries are not meant to be cached.
|
2017-12-11 07:16:04 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[scroll-queries-cannot-use-rescore]]
|
2018-08-28 15:48:23 -04:00
|
|
|
==== Scroll queries cannot use `rescore` anymore
|
2018-10-16 06:31:53 -04:00
|
|
|
|
2018-08-28 15:48:23 -04:00
|
|
|
Including a rescore clause on a query that creates a scroll (`scroll=1m`) has
|
|
|
|
been deprecated in 6.5 and will now return a `400 - Bad request`. Allowing
|
|
|
|
rescore on scroll queries would break the scroll sort. In the 6.x line, the
|
|
|
|
rescore clause was silently ignored (for scroll queries), and it was allowed in
|
|
|
|
the 5.x line.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-12-11 07:16:04 -05:00
|
|
|
==== Term Suggesters supported distance algorithms
|
|
|
|
|
|
|
|
The following string distance algorithms were given additional names in 6.2 and
|
|
|
|
their existing names were deprecated. The deprecated names have now been
|
|
|
|
removed.
|
|
|
|
|
|
|
|
* `levenstein` - replaced by `levenshtein`
|
|
|
|
* `jarowinkler` - replaced by `jaro_winkler`
|
2017-12-28 17:36:29 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[popular-mode-suggesters]]
|
2018-10-19 07:33:19 -04:00
|
|
|
==== `popular` mode for Suggesters
|
|
|
|
|
|
|
|
The `popular` mode for Suggesters (`term` and `phrase`) now uses the doc frequency
|
|
|
|
(instead of the sum of the doc frequency) of the input terms to compute the frequency
|
|
|
|
threshold for candidate suggestions.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-12-28 17:36:29 -05:00
|
|
|
==== Limiting the number of terms that can be used in a Terms Query request
|
|
|
|
|
|
|
|
Executing a Terms Query with a lot of terms may degrade the cluster performance,
|
|
|
|
as each additional term demands extra processing and memory.
|
|
|
|
To safeguard against this, the maximum number of terms that can be used in a
|
|
|
|
Terms Query request has been limited to 65536. This default maximum can be changed
|
|
|
|
for a particular index with the index setting `index.max_terms_count`.
|
2018-02-23 13:41:24 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-02-23 13:41:24 -05:00
|
|
|
==== Limiting the length of regex that can be used in a Regexp Query request
|
|
|
|
|
|
|
|
Executing a Regexp Query with a long regex string may degrade search performance.
|
|
|
|
To safeguard against this, the maximum length of regex that can be used in a
|
|
|
|
Regexp Query request has been limited to 1000. This default maximum can be changed
|
|
|
|
for a particular index with the index setting `index.max_regex_length`.
|
2018-04-11 07:10:22 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-10-29 05:23:07 -04:00
|
|
|
==== Limiting the number of auto-expanded fields
|
|
|
|
|
|
|
|
Executing queries that use automatic expansion of fields (e.g. `query_string`, `simple_query_string`
|
|
|
|
or `multi_match`) can have performance issues for indices with a large numbers of fields.
|
2020-08-18 11:39:09 -04:00
|
|
|
To safeguard against this, a default limit of 1024 fields has been introduced for
|
|
|
|
queries using the "all fields" mode (`"default_field": "*"`) or other fieldname
|
|
|
|
expansions (e.g. `"foo*"`). If needed, you can change this limit using the
|
|
|
|
<<indices-query-bool-max-clause-count,`indices.query.bool.max_clause_count`>>
|
|
|
|
dynamic cluster setting.
|
2018-10-29 05:23:07 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[invalid-search-request-body]]
|
2018-04-11 07:10:22 -04:00
|
|
|
==== Invalid `_search` request body
|
|
|
|
|
|
|
|
Search requests with extra content after the main object will no longer be accepted
|
|
|
|
by the `_search` endpoint. A parsing exception will be thrown instead.
|
2018-06-11 02:49:18 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-01-30 04:31:51 -05:00
|
|
|
==== Doc-value fields default format
|
|
|
|
|
|
|
|
The format of doc-value fields is changing to be the same as what could be
|
|
|
|
obtained in 6.x with the special `use_field_mapping` format. This is mostly a
|
|
|
|
change for date fields, which are now formatted based on the format that is
|
|
|
|
configured in the mappings by default. This behavior can be changed by
|
2020-01-06 09:38:21 -05:00
|
|
|
specifying a <<request-body-search-docvalue-fields,`format`>> within the doc-value
|
2019-01-30 04:31:51 -05:00
|
|
|
field.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-07-09 10:01:01 -04:00
|
|
|
==== Context Completion Suggester
|
|
|
|
|
|
|
|
The ability to query and index context enabled suggestions without context,
|
|
|
|
deprecated in 6.x, has been removed. Context enabled suggestion queries
|
|
|
|
without contexts have to visit every suggestion, which degrades the search performance
|
|
|
|
considerably.
|
|
|
|
|
2018-08-17 11:13:16 -04:00
|
|
|
For geo context the value of the `path` parameter is now validated against the mapping,
|
|
|
|
and the context is only accepted if `path` points to a field with `geo_point` type.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[semantics-changed-max-concurrent-shared-requests]]
|
2018-06-11 02:49:18 -04:00
|
|
|
==== Semantics changed for `max_concurrent_shard_requests`
|
|
|
|
|
|
|
|
`max_concurrent_shard_requests` used to limit the total number of concurrent shard
|
|
|
|
requests a single high level search request can execute. In 7.0 this changed to be the
|
|
|
|
max number of concurrent shard requests per node. The default is now `5`.
|
2018-08-22 11:23:54 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[max-score-set-to-null-when-untracked]]
|
2018-08-22 11:23:54 -04:00
|
|
|
==== `max_score` set to `null` when scores are not tracked
|
|
|
|
|
|
|
|
`max_score` used to be set to `0` whenever scores are not tracked. `null` is now used
|
|
|
|
instead which is a more appropriate value for a scenario where scores are not available.
|
2018-10-16 06:31:53 -04:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-10-16 06:31:53 -04:00
|
|
|
==== Negative boosts are not allowed
|
|
|
|
|
2019-02-01 05:41:40 -05:00
|
|
|
Setting a negative `boost` for a query or a field, deprecated in 6x, is not allowed in this version.
|
|
|
|
To deboost a specific query or field you can use a `boost` comprise between 0 and 1.
|
2018-11-22 06:08:48 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-11-22 06:08:48 -05:00
|
|
|
==== Negative scores are not allowed in Function Score Query
|
|
|
|
|
|
|
|
Negative scores in the Function Score Query are deprecated in 6.x, and are
|
|
|
|
not allowed in this version. If a negative score is produced as a result
|
|
|
|
of computation (e.g. in `script_score` or `field_value_factor` functions),
|
2018-11-26 12:15:59 -05:00
|
|
|
an error will be thrown.
|
2018-12-03 05:49:11 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-12-03 05:49:11 -05:00
|
|
|
==== The filter context has been removed
|
|
|
|
|
|
|
|
The `filter` context has been removed from Elasticsearch's query builders,
|
|
|
|
the distinction between queries and filters is now decided in Lucene depending
|
|
|
|
on whether queries need to access score or not. As a result `bool` queries with
|
|
|
|
`should` clauses that don't need to access the score will no longer set their
|
|
|
|
`minimum_should_match` to 1. This behavior has been deprecated in the previous
|
|
|
|
major version.
|
|
|
|
|
2019-04-10 09:41:04 -04:00
|
|
|
//tag::notable-breaking-changes[]
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[hits-total-now-object-search-response]]
|
2018-12-05 13:49:06 -05:00
|
|
|
==== `hits.total` is now an object in the search response
|
|
|
|
|
|
|
|
The total hits that match the search request is now returned as an object
|
2018-12-27 03:18:28 -05:00
|
|
|
with a `value` and a `relation`. `value` indicates the number of hits that
|
|
|
|
match and `relation` indicates whether the value is accurate (`eq`) or a lower bound
|
2018-12-05 13:49:06 -05:00
|
|
|
(`gte`):
|
2018-12-27 03:18:28 -05:00
|
|
|
|
2019-03-28 13:03:40 -04:00
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-05 13:49:06 -05:00
|
|
|
{
|
2020-07-22 15:57:49 -04:00
|
|
|
"hits": {
|
|
|
|
"total": {
|
|
|
|
"value": 1000,
|
|
|
|
"relation": "eq"
|
|
|
|
},
|
|
|
|
...
|
|
|
|
}
|
2018-12-05 13:49:06 -05:00
|
|
|
}
|
2019-03-28 13:03:40 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// NOTCONSOLE
|
2018-12-05 13:49:06 -05:00
|
|
|
|
2019-03-28 13:03:40 -04:00
|
|
|
The `total` object in the response indicates that the query matches exactly 1000
|
2018-12-05 13:49:06 -05:00
|
|
|
documents ("eq"). The `value` is always accurate (`"relation": "eq"`) when
|
|
|
|
`track_total_hits` is set to true in the request.
|
|
|
|
You can also retrieve `hits.total` as a number in the rest response by adding
|
|
|
|
`rest_total_hits_as_int=true` in the request parameter of the search request.
|
|
|
|
This parameter has been added to ease the transition to the new format and
|
|
|
|
will be removed in the next major version (8.0).
|
2019-04-10 09:41:04 -04:00
|
|
|
//end::notable-breaking-changes[]
|
2018-12-05 13:49:06 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[hits-total-omitted-if-disabled]]
|
2018-12-05 13:49:06 -05:00
|
|
|
==== `hits.total` is omitted in the response if `track_total_hits` is disabled (false)
|
|
|
|
|
2018-12-27 03:18:28 -05:00
|
|
|
If `track_total_hits` is set to `false` in the search request the search response
|
2018-12-05 13:49:06 -05:00
|
|
|
will set `hits.total` to null and the object will not be displayed in the rest
|
|
|
|
layer. You can add `rest_total_hits_as_int=true` in the search request parameters
|
2018-12-27 03:18:28 -05:00
|
|
|
to get the old format back (`"total": -1`).
|
2019-01-25 07:45:39 -05:00
|
|
|
|
2019-04-10 09:41:04 -04:00
|
|
|
//tag::notable-breaking-changes[]
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-05-28 14:16:18 -04:00
|
|
|
[[track-total-hits-10000-default]]
|
2019-01-25 07:45:39 -05:00
|
|
|
==== `track_total_hits` defaults to 10,000
|
|
|
|
|
|
|
|
By default search request will count the total hits accurately up to `10,000`
|
|
|
|
documents. If the total number of hits that match the query is greater than this
|
|
|
|
value, the response will indicate that the returned value is a lower bound:
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
2020-07-22 15:57:49 -04:00
|
|
|
"_shards": ...
|
|
|
|
"timed_out": false,
|
|
|
|
"took": 100,
|
|
|
|
"hits": {
|
|
|
|
"max_score": 1.0,
|
|
|
|
"total": {
|
|
|
|
"value": 10000, <1>
|
|
|
|
"relation": "gte" <2>
|
|
|
|
},
|
|
|
|
"hits": ...
|
|
|
|
}
|
2019-01-25 07:45:39 -05:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// NOTCONSOLE
|
|
|
|
|
|
|
|
<1> There are at least 10000 documents that match the query
|
|
|
|
<2> This is a lower bound (`"gte"`).
|
|
|
|
|
2020-04-10 09:10:59 -04:00
|
|
|
You can force the count to always be accurate by setting `track_total_hits`
|
2019-03-12 05:16:41 -04:00
|
|
|
to true explicitly in the search request.
|
2019-04-10 09:41:04 -04:00
|
|
|
//end::notable-breaking-changes[]
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-04-10 09:41:04 -04:00
|
|
|
==== Limitations on Similarities
|
|
|
|
Lucene 8 introduced more constraints on similarities, in particular:
|
|
|
|
|
|
|
|
- scores must not be negative,
|
|
|
|
- scores must not decrease when term freq increases,
|
|
|
|
- scores must not increase when norm (interpreted as an unsigned long) increases.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-04-10 09:41:04 -04:00
|
|
|
==== Weights in Function Score must be positive
|
|
|
|
Negative `weight` parameters in the `function_score` are no longer allowed.
|
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2019-04-10 09:41:04 -04:00
|
|
|
==== Query string and Simple query string limit expansion of fields to 1024
|
|
|
|
The number of automatically expanded fields for the "all fields"
|
2020-07-29 09:16:29 -04:00
|
|
|
mode (`"default_field": "*"`) for the `query_string` and `simple_query_string`
|
2019-04-10 09:41:04 -04:00
|
|
|
queries is now 1024 fields.
|