-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Add stats parameter support to count API #132963
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
base: main
Are you sure you want to change the base?
Conversation
This change adds support for the 'stats' parameter to the count API, providing feature parity with the search API. The stats parameter allows tagging count requests for logging and statistical purposes. Changes: - Added stats parameter parsing in RestCountAction - Updated count.json API specification to include stats parameter - Added comprehensive unit tests for stats parameter functionality The implementation follows the existing pattern used in RestSearchAction, passing the stats parameter through to the underlying SearchSourceBuilder. Closes elastic#67528 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
javanna
left a comment
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.
Thanks for opening this PR, I left one comment on testing, the change itself looks good.
| import static org.hamcrest.Matchers.hasItems; | ||
| import static org.mockito.Mockito.mock; | ||
|
|
||
| public final class RestCountActionTests extends RestActionTestCase { |
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.
I wonder if we should rather add a yaml test for this. The outcome is very similar. Yet the yaml tests are also run by clients and help verify that the new parameter is support by clients too (and not only by ES)
|
test this please |
|
Hello @natea are you interested in getting this merged? I reviewed this a while back. |
Summary
This PR adds support for the
statsparameter to the count API, providing feature parity with the search API. The stats parameter allows tagging count requests for logging and statistical purposes.Changes
RestCountAction.javacount.jsonAPI specification to include stats parameterRestCountActionTests.javaImplementation Details
The implementation follows the existing pattern used in
RestSearchAction, passing the stats parameter through to the underlyingSearchSourceBuilder. Since the count API internally uses the search API infrastructure, this was a straightforward addition requiring minimal code changes.Testing
Related Issue
Closes #67528
🤖 Generated with Claude Code