Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/reference/migration/migrate_8_0/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ The same functionality can be achieved by the `match` query if the total number

The `cutoff_frequency` parameter was deprecated in 7.x and has been removed in 8.0 from `match` and `multi_match` queries.
The same functionality can be achieved without any configuration provided that the total number of hits is not tracked.

[float]
===== Removal of sort parameters

The `nested_filter` and `nested_path` options, deprecated in 6.x, have been removed in favor of the `nested` context.
16 changes: 5 additions & 11 deletions docs/reference/search/request/sort.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -252,22 +252,16 @@ field support has a `nested` sort option with the following properties:
A filter that the inner objects inside the nested path
should match with in order for its field values to be taken into account
by sorting. Common case is to repeat the query / filter inside the
nested filter or query. By default no `nested_filter` is active.
nested filter or query. By default no `filter` is active.
`max_children`::
The maximum number of children to consider per root document
when picking the sort value. Defaults to unlimited.
`nested`::
Same as top-level `nested` but applies to another nested path within the
current nested object.

[WARNING]
.Nested sort options before Elasticsearch 6.1
============================================

The `nested_path` and `nested_filter` options have been deprecated in
favor of the options documented above.

============================================
NOTE: Elasticsearch will throw an error if a nested field is defined in a sort without
a `nested` context.

===== Nested sorting examples

Expand Down Expand Up @@ -300,7 +294,7 @@ POST /_search
// CONSOLE

In the below example `parent` and `child` fields are of type `nested`.
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.
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.

[source,js]
--------------------------------------------------
Expand Down Expand Up @@ -374,7 +368,7 @@ GET /_search
// CONSOLE

NOTE: If a nested inner object doesn't match with
the `nested_filter` then a missing value is used.
the `nested.filter` then a missing value is used.

==== Ignoring Unmapped Fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ setup:
aggs:
users:
top_hits:
sort: "users.last.keyword"
sort:
users.last.keyword:
nested:
path: users
seq_no_primary_term: true

- match: { hits.total: 2 }
- length: { aggregations.groups.buckets.0.users.hits.hits: 2 }
- match: { aggregations.groups.buckets.0.users.hits.hits.0._id: "1" }
- match: { aggregations.groups.buckets.0.users.hits.hits.0._id: "2" }
- match: { aggregations.groups.buckets.0.users.hits.hits.0._index: my-index }
- gte: { aggregations.groups.buckets.0.users.hits.hits.0._seq_no: 0 }
- gte: { aggregations.groups.buckets.0.users.hits.hits.0._primary_term: 1 }
- match: { aggregations.groups.buckets.0.users.hits.hits.1._id: "2" }
- match: { aggregations.groups.buckets.0.users.hits.hits.1._id: "1" }
- match: { aggregations.groups.buckets.0.users.hits.hits.1._index: my-index }
- gte: { aggregations.groups.buckets.0.users.hits.hits.1._seq_no: 0 }
- gte: { aggregations.groups.buckets.0.users.hits.hits.1._primary_term: 1 }
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ boolean mightMatchNonNestedDocs(String field, String nestedPath) {
return true; // the field is not a sub field of the nested path
}

private static String parentObject(String field) {
public static String parentObject(String field) {
int lastDot = field.lastIndexOf('.');
if (lastDot == -1) {
return null;
Expand Down
Loading