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 MultiGetResponse::toString method #25703

Closed
wants to merge 3 commits into from

Conversation

NeilRickards
Copy link
Contributor

@NeilRickards NeilRickards commented Jul 13, 2017

c.f. SearchResponse::toString

c.f. SearchResponse::toString
@elasticmachine
Copy link
Collaborator

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() + "\"}";
}
}
Copy link
Member

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.

Copy link
Member

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.

@cbuescher
Copy link
Member

@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 toString() methods to all kinds of ActionResponses. There are a few that already do this, but a majority that don't. It might be useful to do this in a more generic way, I don't know if we ever had this discussion but maybe other can comment.

@NeilRickards
Copy link
Contributor Author

That's much neater - I've updated the PR.
I wonder if there's scope for making ActionResponse implement ToXContentObject and overriding toString at that level.

@cbuescher
Copy link
Member

From the looks of it, not all ActionResponses implement ToXContent/ToXContentObject so this will be difficult I think.

@javanna
Copy link
Member

javanna commented Jul 14, 2017

See #3889 . Making ActionResponse implement ToXContentObject should be possible, yet it may require quite some work. We could do it as part of adding support for new apis to the REST high level client.

As for adding toString in general, I even wonder if the toString should output the json representation. Anyways, I am ok with this change. Shall we have a test somewhere?

Copy link
Member

@cbuescher cbuescher left a 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?

@javanna
Copy link
Member

javanna commented Oct 25, 2017

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!

@javanna javanna closed this Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants