private static SearchTotal parseSearchTotal(JsonNode node) {

      final Number value;
      if (node.isNumber()) {
        value = node.numberValue();
      } else {
        value = node.get("value").numberValue();
      }

      return new SearchTotal(value.longValue());
    }
Allows to de-serialize total hits structures.
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/Json.java