You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/search/pages/search-request-params.adoc
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,24 +138,32 @@ Use `search_after` with `from/offset` and `sort` to control pagination in search
138
138
139
139
Give a value for each string or JSON object in the <<sort_arr,sort array>> to the `search_after` array.
140
140
You must provide the values in the same order that they appear in the <<sort_arr,sort array>>.
141
+
Your `sort` array must force a total order on your search results.
142
+
141
143
Values in the `search_after` array must be strings.
142
144
You cannot use `search_after` with numbers or other field data types - if your `sort` array includes fields with a `date` or `number` type, you cannot use `search_after`.
143
145
Only result relevancy score values can be entered as strings in the array.
144
146
145
147
The Search Service starts search result pagination after the document with the values you provide in the array.
146
148
147
-
Use `search_after` to make the memory requirements of deeper page searches more manageable, when compared to using only `from/offset`.
149
+
For example, if you had a set of 10 documents to sort based on `_id` values of 1-10, with `from` set to `2` and `search_after` set to `8`, documents 9-10 appear on the same page.
150
+
151
+
To reduce the resource costs of deeper pagination on your Search queries, try to always include your document ID values as the final sort criteria in your `sort` array.
152
+
Set the `search_after` property to include the values from the last result on your previous page of search results to effectively paginate.
153
+
154
+
Use `search_after` to make the memory requirements of deeper page searches more manageable, when compared to using only `from`/`offset`.
148
155
`search_after` lets you start your search results from a specific result, rather than needing to process a number of search results to skip.
149
156
150
-
To reduce the resource costs of deeper pagination on your Search queries, try to always include your document ID values as the final sort criteria in your <<sort_arr,sort array>>.
151
-
Set the `search_after` property to include the values from the last result on your previous page of search results to effectively paginate.
157
+
|[[search_before]]search_before |Array |No a|
152
158
153
159
NOTE: If you use `search_before` in a search request, you cannot use `search_after`. Both properties are included in the example code to show the correct syntax.
154
160
155
161
Use `search_before` with `from/offset` and `sort` to control pagination in search results.
156
162
157
-
Give a value for each string or JSON object in the `sort` array to the `search_before` array.
163
+
Give a value for each string or JSON object in the <<sort_arr,sort array>> to the `search_before` array.
158
164
You must provide the values in the same order that they appear in the `sort` array.
165
+
Your `sort` array must force a total order on your search results.
166
+
159
167
Values in the `search_before` array must be strings.
160
168
You cannot use `search_before` with numbers or other field data types - if your `sort` array includes fields with a `date` or `number` type, you cannot use `search_before`.
161
169
Only result relevancy score values can be entered as strings in the array.
@@ -164,9 +172,12 @@ The Search Service starts search result pagination before the document with the
164
172
165
173
For example, if you had a set of 10 documents to sort based on `_id` values of 1-10, with `from` set to `2` and `search_before` set to `8`, documents 2-6 appear on the same page.
166
174
167
-
To reduce the resource costs of deeper pagination on your Search queries, try to always include your document ID values as the final sort criteria in your <<sort_arr,sort array>>.
175
+
To reduce the resource costs of deeper pagination on your Search queries, try to always include your document ID values as the final sort criteria in your `sort` array.
168
176
Set the `search_before` property to include the values from the last result on your previous page of search results to effectively paginate.
169
177
178
+
Use `search_before` to make the memory requirements of deeper page searches more manageable, when compared to using only `from`/`offset`.
179
+
`search_before` lets you start your search results back from a specific result, rather than needing to process a number of search results to skip.
180
+
170
181
|[[collections]]collections |Array |No |Contains an array of strings that specify the collections where you want to run the query.
0 commit comments