diff --git a/modules/search/pages/search-request-params.adoc b/modules/search/pages/search-request-params.adoc index a14951e99..25ced5b3e 100644 --- a/modules/search/pages/search-request-params.adoc +++ b/modules/search/pages/search-request-params.adoc @@ -2,7 +2,7 @@ :page-topic-type: reference :page-ui-name: {ui-name} :page-product-name: {product-name} -:page-aliases: fts:fts-creating-with-curl-http-requests-json-structure.adoc, fts:fts-creating-with-curl-http-requests.adoc, fts:fts-search-request.adoc, fts:fts-supported-queries.adoc, fts:fts-supported-queries-query-string-query.adoc, fts:fts-query-string-syntax.adoc, fts:fts-query-string-syntax-boosting.adoc, fts:fts-query-string-syntax-date-ranges.adoc, fts:fts-query-string-syntax-escaping.adoc, fts:fts-query-string-syntax-field-scoping.adoc, fts:fts-query-string-syntax-match-phrase.adoc, fts:fts-query-string-syntax-match.adoc, fts:fts-query-string-syntax-numeric-ranges.adoc, fts:fts-supported-queries-analytic-query.adoc, fts:fts-supported-queries-match.adoc, fts:fts-supported-queries-match-phrase.adoc, fts:fts-supported-queries-non-analytic-query.adoc, fts:fts-supported-queries-term.adoc, fts:fts-supported-queries-phrase.adoc, fts:fts-supported-queries-prefix-query.adoc, fts:fts-supported-queries-regexp.adoc, fts:fts-supported-queries-fuzzy.adoc, fts:fts-supported-queries-wildcard.adoc, fts:fts-supported-queries-compound-query.adoc, fts:fts-supported-queries-conjuncts-disjuncts.adoc, fts:fts-supported-queries-boolean-field-query.adoc, fts:fts-supported-queries-range-query.adoc, fts:fts-supported-queries-numeric-range.adoc, fts:fts-supported-queries-date-range.adoc, fts:fts-supported-queries-term-range.adoc, fts:fts-supported-queries-geospatial.adoc, fts:fts-supported-queries-geopoint-spatial.adoc, fts:fts-supported-queries-geo-point-distance.adoc, fts:fts-supported-queries-geo-bounded-rectangle.adoc, fts:fts-supported-queries-geo-bounded-polygon.adoc, fts:fts-supported-queries-geojson-spatial.adoc, fts:fts-queryshape-point.adoc, fts:fts-queryshape-linestring.adoc, fts:fts-queryshape-polygon.adoc, fts:fts-queryshape-multipoint.adoc, fts:fts-queryshape-multilinestring.adoc, fts:fts-queryshape-multipolygon.adoc, fts:fts-queryshape-geometrycollection.adoc, fts:fts-queryshape-circle.adoc, fts:fts-queryshape-envelope.adoc, fts:fts-supported-queries-special-query.adoc, fts:fts-supported-queries-match-all.adoc, fts:fts-supported-queries-match-none.adoc +:page-aliases: fts:fts-creating-with-curl-http-requests-json-structure.adoc, fts:fts-creating-with-curl-http-requests.adoc, fts:fts-pagination.adoc, fts:fts-search-request.adoc, fts:fts-supported-queries.adoc, fts:fts-supported-queries-query-string-query.adoc, fts:fts-query-string-syntax.adoc, fts:fts-query-string-syntax-boosting.adoc, fts:fts-query-string-syntax-date-ranges.adoc, fts:fts-query-string-syntax-escaping.adoc, fts:fts-query-string-syntax-field-scoping.adoc, fts:fts-query-string-syntax-match-phrase.adoc, fts:fts-query-string-syntax-match.adoc, fts:fts-query-string-syntax-numeric-ranges.adoc, fts:fts-supported-queries-analytic-query.adoc, fts:fts-supported-queries-match.adoc, fts:fts-supported-queries-match-phrase.adoc, fts:fts-supported-queries-non-analytic-query.adoc, fts:fts-supported-queries-term.adoc, fts:fts-supported-queries-phrase.adoc, fts:fts-supported-queries-prefix-query.adoc, fts:fts-supported-queries-regexp.adoc, fts:fts-supported-queries-fuzzy.adoc, fts:fts-supported-queries-wildcard.adoc, fts:fts-supported-queries-compound-query.adoc, fts:fts-supported-queries-conjuncts-disjuncts.adoc, fts:fts-supported-queries-boolean-field-query.adoc, fts:fts-supported-queries-range-query.adoc, fts:fts-supported-queries-numeric-range.adoc, fts:fts-supported-queries-date-range.adoc, fts:fts-supported-queries-term-range.adoc, fts:fts-supported-queries-geospatial.adoc, fts:fts-supported-queries-geopoint-spatial.adoc, fts:fts-supported-queries-geo-point-distance.adoc, fts:fts-supported-queries-geo-bounded-rectangle.adoc, fts:fts-supported-queries-geo-bounded-polygon.adoc, fts:fts-supported-queries-geojson-spatial.adoc, fts:fts-queryshape-point.adoc, fts:fts-queryshape-linestring.adoc, fts:fts-queryshape-polygon.adoc, fts:fts-queryshape-multipoint.adoc, fts:fts-queryshape-multilinestring.adoc, fts:fts-queryshape-multipolygon.adoc, fts:fts-queryshape-geometrycollection.adoc, fts:fts-queryshape-circle.adoc, fts:fts-queryshape-envelope.adoc, fts:fts-supported-queries-special-query.adoc, fts:fts-supported-queries-match-all.adoc, fts:fts-supported-queries-match-none.adoc :description: You can add additional properties to a Search request to control how the Search Service returns results. :page-toclevels: 3 @@ -49,6 +49,9 @@ Set the total number of results to return for a single page of search results. If you provide both the `size` and `limit` properties, the Search Service uses the `size` value. +If you do not provide a `from`, `size`, or other pagination settings in your query, the Search Service defaults to a `size` value of `10` and a `from` value of `0`. +This means the Search Service does not offset results, and returns the first `10` matches to your query. + |from/offset |Integer |No a| Set an offset value to change where pagination starts for search results, based on the Search query's <>. @@ -57,6 +60,9 @@ For example, if you set a `size` value of `5` and a `from` value of `10`, the Se If you provide both the `from` and `offset` properties, the Search Service uses the `from` value. +If you do not provide a `from`, `size`, or other pagination settings in your query, the Search Service defaults to a `size` value of `10` and a `from` value of `0`. +This means the Search Service does not offset results, and returns the first `10` matches to your query. + |highlight |Object |No a| Contains properties to control search result highlighting. @@ -87,9 +93,10 @@ To create an explanation for a search result's score in search results, set `exp To turn off explanations for search result scoring, set `explain` to `false`. -|sort |Array |No a| +|[[sort-array]]sort |Array |No a| -Contains an array of strings or JSON objects to set how to sort search results. +Contains an array of strings or JSON objects to set how to sort search results. +By default, the Search Service sorts results based on score values, from highest to lowest. The strings can be: @@ -116,29 +123,37 @@ To turn on document relevancy scoring in search results, remove the `score` prop |search_after |Array |No a| -NOTE: If you use `search_after` in a search request, you can't use `search_before`. Both properties are included in the example code to show the correct syntax. +NOTE: If you use `search_after` in a search request, you cannot use `search_before`. Both properties are included in the example code to show the correct syntax. Use `search_after` with `from/offset` and `sort` to control pagination in search results. -Give a value for each string or JSON object in the `sort` array to the `search_after` array. +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. + +You must give a value for each string or JSON object in the `sort` array to the `search_after` array. The Search Service starts search result pagination after the document with those values. -You must provide the values in the same order that they appear in the `sort` array. +You must provide the values in the same order that they appear in the `sort` array. +Your `sort` array must force a total order on your search results. -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. +Use `search_after` to make the memory requirements of deeper page searches more manageable, when compared to using only `from/offset`. +`search_after` lets you start your search results from a specific result, rather than needing to process a number of search results to skip. |search_before |Array |No a| -NOTE: If you use `search_before` in a search request, you can't use `search_after`. Both properties are included in the example code to show the correct syntax. +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. Use `search_before` with `from/offset` and `sort` to control pagination in search results. -Give a value for each string or JSON object in the `sort` array to the `search_before` array. +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. + +You must give a value for each string or JSON object in the `sort` array to the `search_before` array. The Search Service starts search result pagination before the document with those values. -You must provide the values in the same order that they appear in the `sort` array. +You must provide the values in the same order that they appear in the `sort` array. +Your `sort` array must force a total order on your search results. -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. +Use `search_before` to make the memory requirements of deeper page searches more manageable, when compared to using only `from/offset`. +`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. |[[collections]]collections |Array |No |Contains an array of strings that specify the collections where you want to run the query. @@ -2126,6 +2141,8 @@ The following `sort` object orders search results by the values in `field1`, the include::example$run-search-full-request.jsonc[tag=sort] ---- +TIP: For the best results with sorting and page navigation in search results, always include your document ID values (`_id` or `-_id`) as the final sort criteria in your `sort` object. + The `sort` object can contain the following string values: [cols="1,2"]