client-adapter/es6x/src/main/java/com/alibaba/otter/canal/client/adapter/es6x/etl/ESEtlService.java [69:119]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    long batchBegin = System.currentTimeMillis();
                    while (rs.next()) {
                        Map<String, Object> esFieldData = new LinkedHashMap<>();
                        Object idVal = null;
                        for (FieldItem fieldItem : mapping.getSchemaItem().getSelectFields().values()) {

                            String fieldName = fieldItem.getFieldName();
                            if (mapping.getSkips().contains(fieldName)) {
                                continue;
                            }

                            // 如果是主键字段则不插入
                if (fieldItem.getFieldName().equals(mapping.getId())) {
                    idVal = esTemplate.getValFromRS(mapping, rs, fieldName, fieldName);
                } else {
                    Object val = esTemplate.getValFromRS(mapping, rs, fieldName, fieldName);
                    esFieldData.put(Util.cleanColumn(fieldName), val);
                }

            }

            if (!mapping.getRelations().isEmpty()) {
                mapping.getRelations().forEach((relationField, relationMapping) -> {
                    Map<String, Object> relations = new HashMap<>();
                    relations.put("name", relationMapping.getName());
                    if (StringUtils.isNotEmpty(relationMapping.getParent())) {
                        FieldItem parentFieldItem = mapping.getSchemaItem()
                            .getSelectFields()
                            .get(relationMapping.getParent());
                        Object parentVal;
                        try {
                            parentVal = esTemplate.getValFromRS(mapping,
                                rs,
                                parentFieldItem.getFieldName(),
                                parentFieldItem.getFieldName());
                        } catch (SQLException e) {
                            throw new RuntimeException(e);
                        }
                        if (parentVal != null) {
                            relations.put("parent", parentVal.toString());
                            esFieldData.put("$parent_routing", parentVal.toString());

                        }
                    }
                    esFieldData.put(Util.cleanColumn(relationField), relations);
                });
            }

            if (idVal != null) {
                String parentVal = (String) esFieldData.remove("$parent_routing");
                if (mapping.isUpsert()) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



client-adapter/es8x/src/main/java/com/alibaba/otter/canal/client/adapter/es8x/etl/ESEtlService.java [69:119]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    long batchBegin = System.currentTimeMillis();
                    while (rs.next()) {
                        Map<String, Object> esFieldData = new LinkedHashMap<>();
                        Object idVal = null;
                        for (FieldItem fieldItem : mapping.getSchemaItem().getSelectFields().values()) {

                            String fieldName = fieldItem.getFieldName();
                            if (mapping.getSkips().contains(fieldName)) {
                                continue;
                            }

                            // 如果是主键字段则不插入
                            if (fieldItem.getFieldName().equals(mapping.getId())) {
                                idVal = esTemplate.getValFromRS(mapping, rs, fieldName, fieldName);
                            } else {
                                Object val = esTemplate.getValFromRS(mapping, rs, fieldName, fieldName);
                                esFieldData.put(Util.cleanColumn(fieldName), val);
                            }

                        }

                        if (!mapping.getRelations().isEmpty()) {
                            mapping.getRelations().forEach((relationField, relationMapping) -> {
                                Map<String, Object> relations = new HashMap<>();
                                relations.put("name", relationMapping.getName());
                                if (StringUtils.isNotEmpty(relationMapping.getParent())) {
                                    FieldItem parentFieldItem = mapping.getSchemaItem()
                                        .getSelectFields()
                                        .get(relationMapping.getParent());
                                    Object parentVal;
                                    try {
                                        parentVal = esTemplate.getValFromRS(mapping,
                                            rs,
                                            parentFieldItem.getFieldName(),
                                            parentFieldItem.getFieldName());
                                    } catch (SQLException e) {
                                        throw new RuntimeException(e);
                                    }
                                    if (parentVal != null) {
                                        relations.put("parent", parentVal.toString());
                                        esFieldData.put("$parent_routing", parentVal.toString());

                                    }
                                }
                                esFieldData.put(Util.cleanColumn(relationField), relations);
                            });
                        }

                        if (idVal != null) {
                            String parentVal = (String) esFieldData.remove("$parent_routing");
                            if (mapping.isUpsert()) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



