Skip to content

Commit 216828e

Browse files
committed
Remove deprecated sort options: nested_path and nested_filter
This commit removes the nested_path and nested_filter options deprecated in 6x. This change also checks that the sort field has a [nested] option if it is under a nested object and throws an exception if it's not the case. Closes elastic#27098
1 parent 43a1dee commit 216828e

File tree

14 files changed

+233
-577
lines changed

14 files changed

+233
-577
lines changed

docs/reference/migration/migrate_8_0/search.asciidoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ The `/{index}/{type}/_termvectors`, `/{index}/{type}/{id}/_termvectors` and `/{i
1212
[float]
1313
==== Removal of queries
1414

15-
The `common` query was deprecated in 7.x and has been removed in 8.0.
16-
The same functionality can be achieved by the `match` query if the total number of hits is not tracked.
15+
* The `common` query was deprecated in 7.x and has been removed in 8.0.
16+
The same functionality can be achieved by the `match` query if the total number of hits is not tracked.
1717

1818
[float]
1919
===== Removal of query parameters
2020

21-
The `cutoff_frequency` parameter was deprecated in 7.x and has been removed in 8.0 from `match` and `multi_match` queries.
22-
The same functionality can be achieved without any configuration provided that the total number of hits is not tracked.
21+
* The `cutoff_frequency` parameter was deprecated in 7.x and has been removed in 8.0 from `match` and `multi_match` queries.
22+
The same functionality can be achieved without any configuration provided that the total number of hits is not tracked.
23+
24+
[float]
25+
===== Removal of sort parameters
26+
27+
* The `nested_filter` and `nested_path` options, deprecated in 6.x, has been removed in favor of the `nested` context.

docs/reference/search/request/sort.asciidoc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,16 @@ field support has a `nested` sort option with the following properties:
252252
A filter that the inner objects inside the nested path
253253
should match with in order for its field values to be taken into account
254254
by sorting. Common case is to repeat the query / filter inside the
255-
nested filter or query. By default no `nested_filter` is active.
255+
nested filter or query. By default no `filter` is active.
256256
`max_children`::
257257
The maximum number of children to consider per root document
258258
when picking the sort value. Defaults to unlimited.
259259
`nested`::
260260
Same as top-level `nested` but applies to another nested path within the
261261
current nested object.
262262

263-
[WARNING]
264-
.Nested sort options before Elasticsearch 6.1
265-
============================================
266-
267-
The `nested_path` and `nested_filter` options have been deprecated in
268-
favor of the options documented above.
263+
NOTE: Elasticsearch will throw an error if a nested field is defined in a sort without
264+
a `nested` context.
269265

270266
============================================
271267
@@ -300,7 +296,7 @@ POST /_search
300296
// CONSOLE
301297
302298
In the below example `parent` and `child` fields are of type `nested`.
303-
The `nested_path` needs to be specified at each level; otherwise, Elasticsearch doesn't know on what nested level sort values need to be captured.
299+
The `nested.path` needs to be specified at each level; otherwise, Elasticsearch doesn't know on what nested level sort values need to be captured.
304300
305301
[source,js]
306302
--------------------------------------------------
@@ -374,7 +370,7 @@ GET /_search
374370
// CONSOLE
375371
376372
NOTE: If a nested inner object doesn't match with
377-
the `nested_filter` then a missing value is used.
373+
the `nested.filter` then a missing value is used.
378374
379375
==== Ignoring Unmapped Fields
380376

server/src/main/java/org/elasticsearch/index/search/NestedHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ boolean mightMatchNonNestedDocs(String field, String nestedPath) {
192192
return true; // the field is not a sub field of the nested path
193193
}
194194

195-
private static String parentObject(String field) {
195+
public static String parentObject(String field) {
196196
int lastDot = field.lastIndexOf('.');
197197
if (lastDot == -1) {
198198
return null;

0 commit comments

Comments
 (0)