From adc4cab1e1cd10d73907e942503e977c67083bc2 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Mon, 28 Mar 2022 17:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87=E7=B4=A2=E5=BC=95=E5=88=AB?= =?UTF-8?q?=E5=90=8D=E8=8E=B7=E5=8F=96mapping=EF=BC=8C=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=BA=E7=9C=9F=E5=AE=9E=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E5=88=AB=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4mappings.get(index).get(type)=E6=8A=A5?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canal/client/adapter/es6x/support/ESConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client-adapter/es6x/src/main/java/com/alibaba/otter/canal/client/adapter/es6x/support/ESConnection.java b/client-adapter/es6x/src/main/java/com/alibaba/otter/canal/client/adapter/es6x/support/ESConnection.java index 266e0b5b26..b63fc9a55c 100644 --- a/client-adapter/es6x/src/main/java/com/alibaba/otter/canal/client/adapter/es6x/support/ESConnection.java +++ b/client-adapter/es6x/src/main/java/com/alibaba/otter/canal/client/adapter/es6x/support/ESConnection.java @@ -150,7 +150,13 @@ public MappingMetaData getMapping(String index, String type) { logger.error(e.getMessage(), e); return null; } - mappingMetaData = mappings.get(index).get(type); + + //通过别名查询mapping返回的是真实索引名称,mappings.get(index)返回null,为兼容别名情况修改如下: + ImmutableOpenMap esIndex = mappings.get(index); + if(esIndex == null){ + esIndex = mappings.valuesIt().next(); + } + mappingMetaData = esIndex.get(type); } return mappingMetaData; }