private static Bucket parseBucket(JsonParser parser, String name, ObjectNode node)
            throws JsonProcessingException  {

      if (!node.has("key")) {
        throw new IllegalArgumentException("No 'key' attribute for " + node);
      }

      final JsonNode keyNode = node.get("key");
      final Object key;
      if (isMissingBucket(keyNode) || keyNode.isNull()) {
        key = null;
      } else if (keyNode.isTextual()) {
        key = keyNode.textValue();
      } else if (keyNode.isNumber()) {
        key = keyNode.numberValue();
      } else if (keyNode.isBoolean()) {
        key = keyNode.booleanValue();
      } else {
        // don't usually expect keys to be Objects
        key = parser.getCodec().treeToValue(node, Map.class);
      }

      return new Bucket(key, name, parseAggregations(parser, node));
    }
Determines if current key is a missing field key. Missing key is returned when document
does not have pivoting attribute (example {@code GROUP BY _MAP['a.b.missing']}). It helps
grouping documents which don't have a field. In relational algebra this
would normally be {@code null}.

<p>Please note that missing value is different for each type.

@param key current {@code key} (usually string) as returned by ES
@return {@code true} if this value
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/Json.java