-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Feature Request] Paginated search queries should hint current position of page in individual page queries #9717
Comments
@reta @dblock @backslasht |
Is this just a bug? When |
@gashutos, can you please clarify the proposed behavior? What exactly should change in the search response? Are you suggesting that using |
Nopes, its not a bug, that's what expected behavior today is to not consider Let me know if this explains, else I can take an example.. |
@msfroh I am not thinking to make |
@gashutos Now I'm even more confused ;)
|
I think
Yeah, I like this idea too. But we will end up achieving same value if we do otherwise as mentined above ? |
I am with you. I think it's a bug that it doesn't. Let's see what others think? Maybe @msfroh ? |
Thanks for that context, I forgot about it :( Do you understand why #9013 had these expectations other than backwards compatibility? I am in support of changing it for 3.0, if we can review/improve |
But the response isn't saying that total hits is 10000, it's saying that the total hits is It's been a while since I looked into the Would it make sense to start the 10k total hit count collection once the Functionally, this would be equivalent to turning the |
@msfroh yes, this is the proposal. To make 'search_after' a filter into query itself to count hits.total.value. This will improve our query performance too when pagination is running over expensive queries, currently it is unnecessarily querying segments/shards where no matching documents for given 'search_after' value but plenty of matching documents for actual query. |
Context / Current behavior
Any
_search
query returnhits.total.value
in response like mentioned in below example. Which specifies how many hits are matching actual query (sort/search_after are not part of query).i.e, check response for below query
Response [partial]
This
hits.total.value
is capped at10000
max as lucene can match at max 10000 documents in results.If you want exact match in
hits.total.value
, we need to addtrack_total_hits=true
in request parameter.i.e.
Response for above query [partial]
If you check, it has exact matching value
247249096
inhits.total.value
.Above calculation results on additional computational costs on
_search
query to track total matching hits. So for performance sensitive queries, it is recommended to providetrack_total_hits=falsle
.i.e
Response from above search query [partial]
Default behaviour for _search queries if
track_total_hits
is not provided as request input, is track matching hits up to 10000 documents as mentioned above.Issue with current behavior
So now, while duing long paginated queries involving 10s of pages, the _search response wont able to give us hint how much pagination is yet to go, because we will end up getting always same
hits.total.value
which matches the exact_search
query but not takingsearch_after
into the account.Proposal
Modify
hits.total.value
logic to honorsearch_after
paramter, so that it always can hint user about current pagination position and how many more such paginated requests are required.The text was updated successfully, but these errors were encountered: