This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 5b2191a496 [fix](multi-catalog)Make ES catalog and resource compatible
(#16096)
5b2191a496 is described below
commit 5b2191a4963403bfd190ffa77b5be8e162382169
Author: qiye <[email protected]>
AuthorDate: Fri Jan 20 09:31:57 2023 +0800
[fix](multi-catalog)Make ES catalog and resource compatible (#16096)
close #16099
1. Make ES resource compatible with `username` property. Keep the same
behavior with ES catalog.
2. Change ES catalog `username` to `user` to avoid confusion.
3. Add log in ESRestClient and make debug easier.
---
docs/zh-CN/docs/lakehouse/multi-catalog/es.md | 2 +-
.../main/java/org/apache/doris/catalog/EsResource.java | 15 ++++++++++++---
.../apache/doris/external/elasticsearch/EsRestClient.java | 2 ++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
b/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
index 5a0bfbbdb7..68fea116ba 100644
--- a/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
+++ b/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
@@ -53,7 +53,7 @@ CREATE CATALOG es PROPERTIES (
参数 | 是否必须 | 默认值 | 说明
--- | --- | --- | ---
`hosts` | 是 | | ES 地址,可以是一个或多个,也可以是 ES 的负载均衡地址 |
-`username` | 否 | 空 | ES 用户名 |
+`user` | 否 | 空 | ES 用户名 |
`password` | 否 | 空 | 对应用户的密码信息 |
`doc_value_scan` | 否 | true | 是否开启通过 ES/Lucene 列式存储获取查询字段的值 |
`keyword_sniff` | 否 | true | 是否对 ES 中字符串分词类型 text.fields 进行探测,通过 keyword
进行查询。设置为 false 会按照分词后的内容匹配 |
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java
index 131ca70e09..1b9d5863d0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java
@@ -85,7 +85,7 @@ public class EsResource extends Resource {
@Override
protected void setProperties(Map<String, String> properties) throws
DdlException {
valid(properties, false);
- this.properties = properties;
+ this.properties = processCompatibleProperties(properties);
}
public static void valid(Map<String, String> properties, boolean isAlter)
throws DdlException {
@@ -124,15 +124,24 @@ public class EsResource extends Resource {
}
}
+ private Map<String, String> processCompatibleProperties(Map<String,
String> props) {
+ // Compatible with ES catalog properties
+ Map<String, String> properties = Maps.newHashMap(props);
+ if (properties.containsKey("username")) {
+ properties.put(EsResource.USER, properties.remove("username"));
+ }
+ return properties;
+ }
+
@Override
public Map<String, String> getCopiedProperties() {
- return Maps.newHashMap(properties);
+ return Maps.newHashMap(processCompatibleProperties(properties));
}
@Override
protected void getProcNodeData(BaseProcResult result) {
String lowerCaseType = type.name().toLowerCase();
- for (Map.Entry<String, String> entry : properties.entrySet()) {
+ for (Map.Entry<String, String> entry :
processCompatibleProperties(properties).entrySet()) {
result.addRow(Lists.newArrayList(name, lowerCaseType,
entry.getKey(), entry.getValue()));
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java
index 1627895936..c5618b8732 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java
@@ -258,6 +258,8 @@ public class EsRestClient {
try (Response response = executeResponse(httpClient, path)) {
if (response.isSuccessful()) {
return response.body().string();
+ } else {
+ LOG.warn("request response code: {}, body: {}",
response.code(), response.body().string());
}
} catch (IOException e) {
LOG.warn("request node [{}] [{}] failures {}, try next nodes",
currentNode, path, e);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]