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

Make hits.total an object in the search response #35849

Merged
merged 58 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8f21601
Make hits.total an object in the search response
jimczi Nov 23, 2018
7f4fe94
fix uts in server module
jimczi Nov 23, 2018
d317113
fix rest high level client
jimczi Nov 23, 2018
5db387d
add support for rest_total_hits_as_int in search_template and msearch…
jimczi Nov 23, 2018
a42ceb1
add support for total_hits as an object in reindex from remote
jimczi Nov 23, 2018
ccd7122
handle the new format of the response in the modules tests
jimczi Nov 23, 2018
3a99e8d
handle the new format of the response in the framework module
jimczi Nov 23, 2018
bed53d9
handle the new format of the response in the plugins's tests
jimczi Nov 23, 2018
e95d760
handle the new format of the response in the qa module
jimczi Nov 23, 2018
48ebbf6
handle the new format of the response in machine learning
jimczi Nov 23, 2018
b2aed0d
handle the new format of the response in watcher
jimczi Nov 23, 2018
d1591fb
handle the new format of the response in security
jimczi Nov 23, 2018
4c174c5
handle the new format of the response in ccr
jimczi Nov 23, 2018
e57d534
handle the new format of the response in monitoring
jimczi Nov 23, 2018
6595b95
handle the new format of the response in upgrade
jimczi Nov 23, 2018
896dadf
handle the new format of the response in rollup
jimczi Nov 23, 2018
9151108
handle the new format of the response in x-pack core
jimczi Nov 23, 2018
89a7b7f
handle the new format of the response in sql
jimczi Nov 23, 2018
f17ed55
handle the new format of the response in x-pack qa module
jimczi Nov 23, 2018
6a913eb
handle the new format of the response in x-pack core uts
jimczi Nov 23, 2018
9a08e14
add object_or_long in the ObjectParser.ValueType enum
jimczi Nov 23, 2018
41fbb1f
update the documentation with the new format
jimczi Nov 23, 2018
144f271
update watcher documentation with the new format
jimczi Nov 23, 2018
64c7ede
add rest_total_hits_as_int in the rest-api specifications of search, …
jimczi Nov 23, 2018
bc69ebb
fix all yml tests to use rest.total_hits_as_int when they access the …
jimczi Nov 23, 2018
b7ef2f0
add yml tests for the new format
jimczi Nov 23, 2018
ba08be8
fix remaining tests that extract the hits.total differently
jimczi Nov 23, 2018
52db197
add missing rest_total_hits_as_int in the search template yml tests
jimczi Nov 23, 2018
8a96c73
Fix wrong comparison
jimczi Nov 23, 2018
5238fba
fix random failures when total_hits is null
jimczi Nov 23, 2018
e676749
Merge branch 'master' into total_hits_as_an_object
jimczi Nov 26, 2018
278802e
address review
jimczi Nov 26, 2018
c7edf1d
fix yml test indentation
jimczi Nov 26, 2018
4b96feb
fix rest test with mixed cluster
jimczi Nov 26, 2018
6a6387b
unused import
jimczi Nov 27, 2018
b0cfe29
Merge branch 'master' into total_hits_as_an_object
jimczi Nov 27, 2018
eb60b52
force watcher search input to use rest_total_hits_as_int for BWC
jimczi Nov 27, 2018
cff7fc7
Merge branch 'master' into total_hits_as_an_object
jimczi Nov 27, 2018
6fd4ff6
iter
jimczi Nov 27, 2018
e21faf7
fix typo in doc
jimczi Nov 27, 2018
30d4312
Merge branch 'master' into total_hits_as_an_object
jimczi Nov 30, 2018
89e63b8
more rest tests
jimczi Nov 30, 2018
4a6c2b4
more rest tests
jimczi Nov 30, 2018
f4a147c
fix tests
jimczi Nov 30, 2018
96c537e
fix yaml test
jimczi Nov 30, 2018
fff896d
fix callout in docs
jimczi Nov 30, 2018
ff88d7e
more tests
jimczi Nov 30, 2018
a0b16d6
adapt watcher to the new search response
jimczi Dec 3, 2018
c46f150
Merge branch 'master' into total_hits_as_an_object
jimczi Dec 3, 2018
c9ddb42
adapt code after merge
jimczi Dec 3, 2018
b24a8ad
checkstyle
jimczi Dec 3, 2018
a80d155
Merge branch 'master' into total_hits_as_an_object
jimczi Dec 3, 2018
2d0b08a
remove usage of rest_total_hits_as_an_int in watcher tests
jimczi Dec 3, 2018
4363cc9
checkstyle
jimczi Dec 3, 2018
be08f43
Merge branch 'master' into total_hits_as_an_object
jimczi Dec 4, 2018
9483224
fix another rest test
jimczi Dec 4, 2018
bc841b4
Merge branch 'master' into total_hits_as_an_object
jimczi Dec 5, 2018
9b6a15b
Merge branch 'master' into total_hits_as_an_object
jimczi Dec 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.elasticsearch.plugin.noop.action.search;

import org.apache.lucene.search.TotalHits;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
Expand Down Expand Up @@ -47,10 +48,10 @@ public TransportNoopSearchAction(TransportService transportService, ActionFilter
protected void doExecute(Task task, SearchRequest request, ActionListener<SearchResponse> listener) {
listener.onResponse(new SearchResponse(new InternalSearchResponse(
new SearchHits(
new SearchHit[0], 0L, 0.0f),
new SearchHit[0], new TotalHits(0L, TotalHits.Relation.EQUAL_TO), 0.0f),
new InternalAggregations(Collections.emptyList()),
new Suggest(Collections.emptyList()),
new SearchProfileShardResults(Collections.emptyMap()), false, false, 1), "", 1, 1, 0, 0, ShardSearchFailure.EMPTY_ARRAY,
SearchResponse.Clusters.EMPTY));
new SearchProfileShardResults(Collections.emptyMap()), false, false, 1),
"", 1, 1, 0, 0, ShardSearchFailure.EMPTY_ARRAY, SearchResponse.Clusters.EMPTY));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void testIndexFollowing() throws Exception {

SearchRequest leaderSearchRequest = new SearchRequest("leader");
SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
assertThat(leaderSearchResponse.getHits().getTotalHits(), equalTo(1L));
assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));

assertBusy(() -> {
CcrStatsRequest ccrStatsRequest = new CcrStatsRequest();
Expand All @@ -118,7 +118,7 @@ public void testIndexFollowing() throws Exception {

SearchRequest followerSearchRequest = new SearchRequest("follower");
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
assertThat(followerSearchResponse.getHits().getTotalHits(), equalTo(1L));
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
});

PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
Expand All @@ -143,7 +143,7 @@ public void testIndexFollowing() throws Exception {

SearchRequest followerSearchRequest = new SearchRequest("follower");
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
assertThat(followerSearchResponse.getHits().getTotalHits(), equalTo(2L));
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(2L));
});

// Need to pause prior to unfollowing it:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ public void testDeleteByQuery() throws Exception {
assertEquals(0, bulkResponse.getSearchFailures().size());
assertEquals(
2,
highLevelClient().search(new SearchRequest(sourceIndex), RequestOptions.DEFAULT).getHits().totalHits
highLevelClient().search(new SearchRequest(sourceIndex), RequestOptions.DEFAULT).getHits().getTotalHits().value
);
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void testSearchScroll() throws IOException {
SearchResponse searchResponse = restHighLevelClient.scroll(
new SearchScrollRequest(randomAlphaOfLengthBetween(5, 10)), RequestOptions.DEFAULT);
assertEquals(mockSearchResponse.getScrollId(), searchResponse.getScrollId());
assertEquals(0, searchResponse.getHits().totalHits);
assertEquals(0, searchResponse.getHits().getTotalHits().value);
assertEquals(5, searchResponse.getTotalShards());
assertEquals(5, searchResponse.getSuccessfulShards());
assertEquals(100, searchResponse.getTook().getMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void testPutStartAndGetRollupJob() throws Exception {
assertBusy(() -> {
SearchResponse searchResponse = highLevelClient().search(new SearchRequest(rollupIndex), RequestOptions.DEFAULT);
assertEquals(0, searchResponse.getFailedShards());
assertEquals(1L, searchResponse.getHits().getTotalHits());
assertEquals(1L, searchResponse.getHits().getTotalHits().value);

SearchHit searchHit = searchResponse.getHits().getAt(0);
Map<String, Object> source = searchHit.getSourceAsMap();
Expand Down
Loading