-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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 MultiGetResponse::toString method #25703
Conversation
c.f. SearchResponse::toString
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
} catch (IOException e) { | ||
return "{ \"error\" : \"" + e.getMessage() + "\"}"; | ||
} | ||
} |
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.
You can simply use Strings.toString(this)
instead, at least that's what e.g. GetResponse does.
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.
Sorry, this doesn't compile now.
@NeilRickards thanks for this PR. I left a comment about how I think this can be made shorter. More generally I'm wondering if we should go down the road of adding |
That's much neater - I've updated the PR. |
From the looks of it, not all ActionResponses implement ToXContent/ToXContentObject so this will be difficult I think. |
See #3889 . Making ActionResponse implement As for adding |
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.
@NeilRickards revisiting this after some time, whould you mind adding a short test for the toString() output like @javanna suggested?
I am closing this for now given that it's missing tests and we are not going to integrate it without them. Feel free to reopen once you have time to work on it. Thanks! |
c.f. SearchResponse::toString