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

Add support for rest_total_hits_as_int in watcher #36035

Merged
merged 3 commits into from
Nov 30, 2018

Conversation

jimczi
Copy link
Contributor

@jimczi jimczi commented Nov 29, 2018

This change adds the support for rest_total_hits_as_int
in the watcher search inputs. Setting this parameter in the request
will transform the search response to contain the total hits as
a number (instead of an object).
Note that this parameter is currently a noop since #35849 is not
merged.

Closes #36008

This change adds the support for rest_total_hits_as_int
in the watcher search inputs. Setting this parameter in the request
will transform the search response to contain the total hits as
a number (instead of an object).
Note that this parameter is currently a noop since elastic#35849 is not
merged.

Closes elastic#36008
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@jimczi jimczi added the :Search/Search Search-related issues that do not fall into other categories label Nov 29, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

Copy link
Contributor

@spinscale spinscale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two minor cosmetic things, otherwise LGTM (no need for a further round), as tests seem to pass

@@ -86,7 +87,12 @@ public ExecutableSearchInput(SearchInput input, Client client, WatcherSearchTemp

final Payload payload;
if (input.getExtractKeys() != null) {
BytesReference bytes = XContentHelper.toXContent(response, XContentType.JSON, false);
Map<String, String> paramsMap = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of allocating a new objects, can you juse have a static MapParams variable, that uses Collections.singletonMap()?

indicesOptions, searchSource, template);
WatcherSearchTemplateRequest request = new WatcherSearchTemplateRequest(indices.toArray(new String[0]),
types.toArray(new String[0]), searchType, indicesOptions, searchSource, template);
if (totalHitsAsInt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this if statement needed with the above defined default value?

@jimczi jimczi merged commit e179fd1 into elastic:master Nov 30, 2018
@jimczi jimczi deleted the watcher_rest_total_hits_as_int branch November 30, 2018 17:02
jimczi added a commit that referenced this pull request Nov 30, 2018
This change adds the support for rest_total_hits_as_int
in the watcher search inputs. Setting this parameter in the request
will transform the search response to contain the total hits as
a number (instead of an object).
Note that this parameter is currently a noop since #35849 is not
merged.

Closes #36008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Watcher >non-issue :Search/Search Search-related issues that do not fall into other categories v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants