mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
通过索引别名获取mapping,返回数据为真实索引,而不是别名,导致mappings.get(index).get(type)报空指针异常 (#4122)
This commit is contained in:
@@ -150,7 +150,13 @@ public class ESConnection {
|
||||
logger.error(e.getMessage(), e);
|
||||
return null;
|
||||
}
|
||||
mappingMetaData = mappings.get(index).get(type);
|
||||
|
||||
//通过别名查询mapping返回的是真实索引名称,mappings.get(index)返回null,为兼容别名情况修改如下:
|
||||
ImmutableOpenMap<String, MappingMetaData> esIndex = mappings.get(index);
|
||||
if(esIndex == null){
|
||||
esIndex = mappings.valuesIt().next();
|
||||
}
|
||||
mappingMetaData = esIndex.get(type);
|
||||
}
|
||||
return mappingMetaData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user