-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Conversation
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
Pinging @elastic/es-core-features |
Pinging @elastic/es-search |
There was a problem hiding this 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<>(); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
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 #35849 is not
merged.
Closes #36008