コード例 #1
0
 public byte[] buildAsBytes(XContentType contentType) throws SearchSourceBuilderException {
   try {
     XContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
     toXContent(builder, EMPTY_PARAMS);
     return builder.copiedBytes();
   } catch (Exception e) {
     throw new SearchSourceBuilderException("Failed to build search source", e);
   }
 }
コード例 #2
0
 public FastByteArrayOutputStream buildAsUnsafeBytes(XContentType contentType)
     throws SearchSourceBuilderException {
   try {
     BinaryXContentBuilder builder = XContentFactory.contentBinaryBuilder(contentType);
     toXContent(builder, ToXContent.EMPTY_PARAMS);
     return builder.unsafeStream();
   } catch (Exception e) {
     throw new SearchSourceBuilderException("Failed to build search source", e);
   }
 }