Make hits.total an object in the search response#35849
Merged
jimczi merged 58 commits intoelastic:masterfrom Dec 5, 2018
Merged
Make hits.total an object in the search response#35849jimczi merged 58 commits intoelastic:masterfrom
jimczi merged 58 commits intoelastic:masterfrom
Conversation
Collaborator
|
Pinging @elastic/es-search |
Contributor
Author
|
Note that this pr depends on #35848 to pass the BWC rest tests. |
Contributor
Author
|
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
Contributor
Author
|
@elasticmachine run the gradle build tests 2 |
Contributor
Author
|
run sample packaging tests |
Contributor
Author
|
run default distro tests |
Contributor
Author
|
run the gradle build tests 2 |
1 similar comment
Contributor
Author
|
run the gradle build tests 2 |
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Dec 6, 2018
* 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 ...
robbavey
added a commit
to robbavey/logstash-output-elasticsearch
that referenced
this pull request
Dec 12, 2018
elastic/elasticsearch#35849 changed the search response format, which broke a bunch of tests.
elasticsearch-bot
pushed a commit
to logstash-plugins/logstash-output-elasticsearch
that referenced
this pull request
Dec 13, 2018
elastic/elasticsearch#35849 changed the search response format, which broke a bunch of tests. Fixes #817
This was referenced Dec 19, 2018
9 tasks
|
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. |
Contributor
Author
|
@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 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.
This commit changes the format of the
hits.totalin the search response to be an object witha
valueand arelation. Thevalueindicates the number of hits that match the query and therelationindicates 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_intthat 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