@Override
 public void toXContent(XContentBuilder builder, Params params) throws IOException {
   hits.toXContent(builder, params);
   if (facets != null) {
     facets.toXContent(builder, params);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   hits.writeTo(out);
   if (facets == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     facets.writeTo(out);
   }
   out.writeBoolean(timedOut);
 }