-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Migrates more ToXContentClasses #26321
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
Changes from 4 commits
f4731d3
7dd4bfa
8b39d20
e14c83e
e32a3a5
d000aa2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,16 +18,19 @@ | |
| */ | ||
| package org.elasticsearch.index.query; | ||
|
|
||
| import org.elasticsearch.ElasticsearchException; | ||
| import org.elasticsearch.Version; | ||
| import org.elasticsearch.action.support.ToXContentToBytes; | ||
| import org.elasticsearch.common.ParseField; | ||
| import org.elasticsearch.common.ParsingException; | ||
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.common.io.stream.Writeable; | ||
| import org.elasticsearch.common.xcontent.ObjectParser; | ||
| import org.elasticsearch.common.xcontent.ToXContentObject; | ||
| import org.elasticsearch.common.xcontent.XContentBuilder; | ||
| import org.elasticsearch.common.xcontent.XContentHelper; | ||
| import org.elasticsearch.common.xcontent.XContentParser; | ||
| import org.elasticsearch.common.xcontent.XContentType; | ||
| import org.elasticsearch.script.Script; | ||
| import org.elasticsearch.search.builder.SearchSourceBuilder; | ||
| import org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField; | ||
|
|
@@ -47,7 +50,7 @@ | |
|
|
||
| import static org.elasticsearch.common.xcontent.XContentParser.Token.END_OBJECT; | ||
|
|
||
| public final class InnerHitBuilder extends ToXContentToBytes implements Writeable { | ||
| public final class InnerHitBuilder implements Writeable, ToXContentObject { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we add toString impl to this class now that it doesn't inherit anymore from ToXContentToBytes?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this applies to all the classes that don't extend from ToXCOntentToBytes anymore and don't declare their own toString . |
||
|
|
||
| public static final ParseField NAME_FIELD = new ParseField("name"); | ||
| public static final ParseField IGNORE_UNMAPPED = new ParseField("ignore_unmapped"); | ||
|
|
@@ -544,4 +547,13 @@ public int hashCode() { | |
| public static InnerHitBuilder fromXContent(XContentParser parser) throws IOException { | ||
| return PARSER.parse(parser, new InnerHitBuilder(), null); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| try { | ||
| return XContentHelper.toXContent(this, XContentType.JSON, true).utf8ToString(); | ||
| } catch (IOException e) { | ||
| throw new ElasticsearchException(e); | ||
| } | ||
| } | ||
| } | ||
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.
Strings.toString already catches IOException. there is a variant of it where you can pass in pretty and himanReadable flags.