ElasticResponse { @Override public String toString() { return "ElasticResponse[total=" + getTotalNumHits() + ", hits=" + getNumHits() + ", aggregations=" + aggregations + ", scrollId=" + scrollId + ", maxScore=" + getMaxScore() + "]"; }  ElasticResults getResults(); Map<String,ElasticAggregation> getAggregations(); String getScrollId(); @JsonIgnore List<ElasticHit> getHits(); int getNumHits(); long getTotalNumHits(); float getMaxScore(); @Override String toString();  }
@Test public void testToString() throws IOException { String content = "{\"hits\":{\"hits\":[{\"_source\": {\"tags\":[\"red\"]}}]}, " + "\"aggregations\":{\"first\":{\"buckets\": [{\"key\":\"0\",\"doc_count\":10}]}}}"; ElasticResponse response = mapper.readValue(content, ElasticResponse.class); String responseStr = response.toString(); assertTrue(responseStr.contains("hits=1")); assertTrue(responseStr.contains("numBuckets=1")); }