[8.17] [Search] Fix content Indices documents error on paginate (#219471)#219626
Merged
saarikabhasi merged 1 commit intoelastic:8.17from Apr 30, 2025
Merged
Conversation
) Initially added fix in `8.17` branch in [PR](elastic#219411), but need this change in `main`, `8.18`, `8.19` & `9.0.0` and the file's paths are different in all versions(main, 8.18/8.19, 8.17, 9.0.0). Created this new PR, adding fix in `main` & will try to backport to other versions. ## Summary When `track_total_hits` is not provided to `fetchSearchResults`, the value is set to `false`. As a result, the `search` api does not include total hit count in its response. Thus, the total count of hit is 0 and onPaginate results in error. This PR sets `track_total_hits` as an optional argument in `fetchSearchResults` **Note** One other option would be to set `track_total_hits` to true but, based on this [documentation](https://www.elastic.co/docs/solutions/search/the-search-api#track-total-hits) setting `track_total_hits` to true would affect query performance. ``` Setting track_total_hits to true will cause Elasticsearch to return exact hit counts, which could hurt query performance because it disables the [Max WAND](https://www.elastic.co/blog/faster-retrieval-of-top-hits-in-elasticsearch-with-block-max-wand) optimization. ```` https://github.com/user-attachments/assets/4284e88f-2614-4fbe-a0eb-1980355f5bff ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 69d7124)
1 task
TattdCodeMonkey
approved these changes
Apr 29, 2025
Member
Author
|
/ci |
Contributor
💚 Build Succeeded
Metrics [docs]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.17:Questions ?
Please refer to the Backport tool documentation