diff --git a/_search-plugins/searching-data/paginate.md b/_search-plugins/searching-data/paginate.md index 66873b2572..397dde39c7 100644 --- a/_search-plugins/searching-data/paginate.md +++ b/_search-plugins/searching-data/paginate.md @@ -159,7 +159,7 @@ Because open search contexts consume a lot of memory, we suggest you don't use t The `search_after` parameter provides a live cursor that uses the previous page's results to obtain the next page's results. It is similar to the `scroll` operation in that it is meant to scroll many queries in parallel. You can use `search_after` only when sorting is applied. -For example, the following query sorts all lines from the play "Hamlet" by the speech number and then the ID and retrieves the first three results: +For example, the following query sorts all lines from the play "Hamlet" by the speech number and then the line ID and retrieves the first three results: ```json GET shakespeare/_search @@ -172,7 +172,7 @@ GET shakespeare/_search }, "sort": [ { "speech_number": "asc" }, - { "_id": "asc" } + { "line_id": "asc" } ] } ``` @@ -211,7 +211,7 @@ The response contains the `sort` array of values for each document: }, "sort" : [ 1, - "32435" + 32436 ] }, { @@ -229,7 +229,7 @@ The response contains the `sort` array of values for each document: }, "sort" : [ 1, - "32634" + 32635 ] }, { @@ -247,7 +247,7 @@ The response contains the `sort` array of values for each document: }, "sort" : [ 1, - "32635" + 32636 ] } ] @@ -266,10 +266,10 @@ GET shakespeare/_search "play_name": "Hamlet" } }, - "search_after": [ 1, "32635"], + "search_after": [ 1, 32636], "sort": [ { "speech_number": "asc" }, - { "_id": "asc" } + { "line_id": "asc" } ] } ``` diff --git a/_search-plugins/searching-data/sort.md b/_search-plugins/searching-data/sort.md index 804b129721..8947ce1120 100644 --- a/_search-plugins/searching-data/sort.md +++ b/_search-plugins/searching-data/sort.md @@ -879,4 +879,6 @@ For each document, the sorting distance is calculated as the minimum, maximum, o ## Performance considerations -Sorted field values are loaded into memory for sorting. Therefore, for minimum overhead we recommend mapping [numeric types]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/numeric) to the smallest acceptable types, like `short`, `integer`, and `float`. [String types]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/string) should not have the sorted field analyzed or tokenized. \ No newline at end of file +Sorted field values are loaded into memory for sorting. Therefore, for minimum overhead we recommend mapping [numeric types]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/numeric) to the smallest acceptable types, like `short`, `integer`, and `float`. [String types]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/string) should not have the sorted field analyzed or tokenized. + +The `_id` field is restricted from use in sorting operations. If you need to sort by document ID, consider duplicating the ID value into another field with `doc_values` enabled. For more information about `_id` field limitations, see [ID field type]({{site.url}}{{site.baseurl}}/field-types/metadata-fields/id/). \ No newline at end of file