Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding documentation for Pagination in hybrid query #9109

Merged

Conversation

vibrantvarun
Copy link
Member

Description

Making following changes:

Issues Resolved

#8952

Version

2.19

Frontend features

None

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Varun Jain <[email protected]>
Copy link

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

**Introduced 2.19**
{: .label .label-purple }

You can apply pagination in the search results by providing `pagination_depth` in the hybrid query clause. The value of `pagination_depth` will define the maximum count of search results that can be retrieved from each shard per subquery. For example, `pagination_depth = 50` means at max total of 50 results can be catered for each subquery per shard. The `pagination_depth` is responsible for holding the search results reference on which user can paginate by using `from` and `size` parameters. The `from` parameter will define the document number from which you want to start showing the results. The `size` paramater is the number of results that you want to show. Together, they let you return a subset of the search results. For more information about pagination, see [paginate results]({{site.url}}{{site.baseurl}}/search-plugins/searching-data/paginate/#the-from-and-size-parameters).
Copy link
Member

@ryanbogan ryanbogan Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about putting one sentence at the beginning describing a broad strokes definition of pagination? Rest looks good to me!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to simplify this paragraph, and also clearly mention how to use from and size. I suggest to rework paragraph into to something along these lines:

You can apply pagination to hybrid query results by using the `pagination_depth` parameter in the hybrid query clause, along with the standard `from` and `size` parameters. The `pagination_depth` parameter defines the maximum number of search results that can be retrieved from each shard per subquery. For example, setting `pagination_depth: 50` allows up to 50 results per subquery to be maintained in memory for each shard.

To navigate through the results, use:
- `from`: specifies the starting position of the results to return, default is `0`
- `size`: specifies the number of results to return, default is `10`

For example, to get results 20-30, set `from: 20` and `size: 10`. Note that higher values of `pagination_depth` will increase memory usage. For more information about pagination, see [paginate results] <link>.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanbogan we have already attached the link of pagination main page. So if a user is unknown to pagination they can read it from there. Adding it here would create duplicacy and overhead.

**Introduced 2.19**
{: .label .label-purple }

You can apply pagination in the search results by providing `pagination_depth` in the hybrid query clause. The value of `pagination_depth` will define the maximum count of search results that can be retrieved from each shard per subquery. For example, `pagination_depth = 50` means at max total of 50 results can be catered for each subquery per shard. The `pagination_depth` is responsible for holding the search results reference on which user can paginate by using `from` and `size` parameters. The `from` parameter will define the document number from which you want to start showing the results. The `size` paramater is the number of results that you want to show. Together, they let you return a subset of the search results. For more information about pagination, see [paginate results]({{site.url}}{{site.baseurl}}/search-plugins/searching-data/paginate/#the-from-and-size-parameters).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to simplify this paragraph, and also clearly mention how to use from and size. I suggest to rework paragraph into to something along these lines:

You can apply pagination to hybrid query results by using the `pagination_depth` parameter in the hybrid query clause, along with the standard `from` and `size` parameters. The `pagination_depth` parameter defines the maximum number of search results that can be retrieved from each shard per subquery. For example, setting `pagination_depth: 50` allows up to 50 results per subquery to be maintained in memory for each shard.

To navigate through the results, use:
- `from`: specifies the starting position of the results to return, default is `0`
- `size`: specifies the number of results to return, default is `10`

For example, to get results 20-30, set `from: 20` and `size: 10`. Note that higher values of `pagination_depth` will increase memory usage. For more information about pagination, see [paginate results] <link>.

_search-plugins/hybrid-search.md Outdated Show resolved Hide resolved
_search-plugins/hybrid-search.md Outdated Show resolved Hide resolved
@kolchfa-aws kolchfa-aws added release-notes PR: Include this PR in the automated release notes v2.19.0 labels Jan 27, 2025

For example, to show results from 20th document to 30th document, set `from: 20` and `size: 10`. For more information about pagination, see [paginate results]({{site.url}}{{site.baseurl}}/search-plugins/searching-data/paginate/#the-from-and-size-parameters).

### The impact of pagination_depth on hybrid search results
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph is let user know that changing the pagination_depth also changes the search results reference.


### The impact of pagination_depth on hybrid search results

The change in `pagination_depth` also affects the search results ordering on which the user is paginating. This is because altering the `pagination_depth` directly impacts the number of results retrieved for each subquery per shard, which may ultimately might change the result ordering after normalization. Therefore, it is recommended to maintain a consistent value of `pagination_depth` while navigating between pages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the end of the first sentence as it feels a little clunky. How about The change in pagination_depth also affects the ordering of search results.

Copy link
Member Author

@vibrantvarun vibrantvarun Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentially what i want to say here is if user changes pagination_depth then it will change the ground truth on which the user is paginating.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, I still think there is probably a better way to phrase it but I can't think of anything. It's technically sound, so we can leave phrasing to the doc team

Signed-off-by: Varun Jain <[email protected]>
Signed-off-by: Varun Jain <[email protected]>
Copy link
Member

@martin-gaievski martin-gaievski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good from technical point of view, thank you

@kolchfa-aws kolchfa-aws added the 4 - Doc review PR: Doc review in progress label Jan 29, 2025
Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: Fanit Kolchina <[email protected]>
Copy link
Collaborator

@natebower natebower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolchfa-aws @vibrantvarun Just two minor changes. Thanks!

_search-plugins/hybrid-search.md Outdated Show resolved Hide resolved
_search-plugins/hybrid-search.md Outdated Show resolved Hide resolved
Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>
@kolchfa-aws kolchfa-aws removed the 4 - Doc review PR: Doc review in progress label Jan 31, 2025
@kolchfa-aws kolchfa-aws merged commit aafbddd into opensearch-project:main Jan 31, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes PR: Include this PR in the automated release notes v2.19.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants