private static void applyMapping(ObjectNode parent, String key, String type) {
    final int index = key.indexOf('.');
    if (index > -1) {
      String prefix  = key.substring(0, index);
      String suffix = key.substring(index + 1);
      applyMapping(parent.with(prefix).with("properties"), suffix, type);
    } else {
      parent.with(key).put("type", type);
    }
  }
Creates nested mappings for an index. This function is called recursively for each level.

@param parent current parent
@param key field name
@param type ES mapping type ({@code keyword}, {@code long} etc.)
criteria/elasticsearch/src/org/immutables/criteria/elasticsearch/IndexOps.java