Skip to content
Open
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
14 changes: 7 additions & 7 deletions _search-plugins/searching-data/paginate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -172,7 +172,7 @@ GET shakespeare/_search
},
"sort": [
{ "speech_number": "asc" },
{ "_id": "asc" }
{ "line_id": "asc" }
]
}
```
Expand Down Expand Up @@ -211,7 +211,7 @@ The response contains the `sort` array of values for each document:
},
"sort" : [
1,
"32435"
32436
]
},
{
Expand All @@ -229,7 +229,7 @@ The response contains the `sort` array of values for each document:
},
"sort" : [
1,
"32634"
32635
]
},
{
Expand All @@ -247,7 +247,7 @@ The response contains the `sort` array of values for each document:
},
"sort" : [
1,
"32635"
32636
]
}
]
Expand All @@ -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" }
]
}
```
Expand Down
4 changes: 3 additions & 1 deletion _search-plugins/searching-data/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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/).