Skip to content

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

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