public static Map<String, Object> rowToJsonMap(Row row, List<String> fields, List<String> types) {
        Preconditions.checkArgument(row.getArity() == fields.size());
        Map<String,Object> jsonMap = new HashMap<>();
        int i = 0;
        for(; i < fields.size(); ++i) {
            String field = fields.get(i);
            String[] parts = field.split("\\.");
            Map<String, Object> currMap = jsonMap;
            for(int j = 0; j < parts.length - 1; ++j) {
                String key = parts[j];
                if(currMap.get(key) == null) {
                    currMap.put(key, new HashMap<String,Object>());
                }
                currMap = (Map<String, Object>) currMap.get(key);
            }
            String key = parts[parts.length - 1];
            Object col = row.getField(i);
            if(col != null) {
                Object value = DtStringUtil.col2string(col, types.get(i));
                currMap.put(key, value);
            }

        }

        return jsonMap;
    }
Utilities for ElasticSearch

Company: www.dtstack.com
@author huyifan.zju@163.com
elasticsearch5-xh/elasticsearch5-xh-sink/src/main/java/com/dtstack/flink/sql/sink/elasticsearch/EsUtil.java