-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Make hits.total an object in the search response #35849
Conversation
Pinging @elastic/es-search |
Note that this pr depends on #35848 to pass the BWC rest tests. |
test this please |
This commit changes the format of the `hits.total` in the search response to be an object with a `value` and a `relation`. The `value` indicates the number of hits that match the query and the `relation` indicates whether the number is accurate (in which case the relation is equals to `eq`) or a lower bound of the total (in which case it is equals to `gte`). This change also adds a parameter called `rest_total_hits_as_int` that can be used in the search APIs to opt out from this change (retrieve the total hits as a number in the rest response). Note that currently all search responses are accurate (`track_total_hits: true`) or they don't contain `hits.total` (`track_total_hits: true`). We'll add a way to get a lower bound of the total hits in a follow up (to allow numbers to be passed to `track_total_hits`). Relates elastic#33028
@elasticmachine run the gradle build tests 2 |
run sample packaging tests |
run default distro tests |
run the gradle build tests 2 |
1 similar comment
run the gradle build tests 2 |
* master: (133 commits) SNAPSHOT: Increase Timeout to Stabilize Test (elastic#36294) Fix get certificates HLRC API (elastic#36198) Avoid shutting down the only master (elastic#36272) Fix typo in comment Fix total hits serialization of the search response (elastic#36290) Fix FullClusterRestartIT#testRollupIDSchemeAfterRestart Mute FullClusterRestartIT#testRollupIDSchemeAfterRestart as we await a fix. [Docs] Add Profile API limitations (elastic#36252) Make sure test don't use Math.random for reproducability (elastic#36241) Fix compilation ingest: support default pipeline through an alias (elastic#36231) Zen2: Rename tombstones to exclusions (elastic#36226) [Zen2] Hide not recovered state (elastic#36224) Test: mute testDataNodeRestartWithBusyMasterDuringSnapshot Test: mute testSnapshotAndRestoreWithNested Revert "Test: mute failing mtermvector rest test" Test: mute failing mtermvector rest test add version 6.5.3 (elastic#36268) Make hits.total an object in the search response (elastic#35849) [DOCS] Fixes broken link in execute watch ...
elastic/elasticsearch#35849 changed the search response format, which broke a bunch of tests.
elastic/elasticsearch#35849 changed the search response format, which broke a bunch of tests. Fixes #817
Will not this break the Rest api in 6.x while the upgrade is happening? We are using the java rest api 6.7 and I did not find any way of setting track_total_hits=true and rest_total_hits_as_int=true. |
@Musfiqur01, see #46076, the Java client sets this option automatically from version |
nice.
What about setting track_total_hits = true?
…-Musfiqur
On Aug 20, 2020, at 7:21 PM, Jim Ferenczi ***@***.***> wrote:
@Musfiqur01, see #46076, clients sets this option automatically from version 6.8.3.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
From 46076, it appears that the change is only sending rest_total_hit_as_int = true. Is it also setting track_total_hits=true? |
This commit changes the format of the
hits.total
in the search response to be an object witha
value
and arelation
. Thevalue
indicates the number of hits that match the query and therelation
indicates whether the number is accurate (in which case the relation is equals toeq
)or a lower bound of the total (in which case it is equals to
gte
).This change also adds a parameter called
rest_total_hits_as_int
that can be used in thesearch APIs to opt out from this change (retrieve the total hits as a number in the rest response).
Note that currently all search responses are accurate (
track_total_hits: true
) or they don't containhits.total
(track_total_hits: true
). We'll add a way to get a lower bound of the total hits in afollow up (to allow numbers to be passed to
track_total_hits
).Relates #33028