File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
src/main/java/org/elasticsearch/action/search Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 99import org .elasticsearch .common .xcontent .ToXContent ;
1010import org .elasticsearch .common .xcontent .XContentBuilder ;
1111import org .elasticsearch .common .xcontent .XContentBuilderString ;
12+ import org .elasticsearch .common .xcontent .XContentFactory ;
1213
1314import java .io .IOException ;
1415import java .util .Iterator ;
@@ -168,4 +169,17 @@ static final class Fields {
168169 static final XContentBuilderString RESPONSES = new XContentBuilderString ("responses" );
169170 static final XContentBuilderString ERROR = new XContentBuilderString ("error" );
170171 }
172+
173+ @ Override
174+ public String toString () {
175+ try {
176+ XContentBuilder builder = XContentFactory .jsonBuilder ().prettyPrint ();
177+ builder .startObject ();
178+ toXContent (builder , EMPTY_PARAMS );
179+ builder .endObject ();
180+ return builder .string ();
181+ } catch (IOException e ) {
182+ return "{ \" error\" : \" " + e .getMessage () + "\" }" ;
183+ }
184+ }
171185}
You can’t perform that action at this time.
0 commit comments