This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 646f53b29b557a314d88eefeedce285038593b99
Author: Guangdong Liu <[email protected]>
AuthorDate: Sun Oct 8 14:35:08 2023 +0800

    [feature](es-catalog) add `include_hidden_index`in order to get the hidden 
index. (#24826)
---
 .../elasticsearch/scripts/es_init.sh               |   5 +
 .../elasticsearch/scripts/index/es6_hide.json      |  88 +++++++++++++++++
 .../elasticsearch/scripts/index/es7_hide.json      | 104 +++++++++++++++++++++
 docs/en/docs/lakehouse/multi-catalog/es.md         |  23 ++---
 docs/zh-CN/docs/lakehouse/multi-catalog/es.md      |  23 ++---
 .../java/org/apache/doris/catalog/EsResource.java  |   6 ++
 .../java/org/apache/doris/catalog/EsTable.java     |  14 ++-
 .../doris/catalog/external/EsExternalTable.java    |   1 +
 .../apache/doris/datasource/EsExternalCatalog.java |   7 +-
 .../doris/external/elasticsearch/EsRestClient.java |  13 ++-
 .../external_table_p0/es/test_es_query.groovy      |  61 ++++++++++++
 11 files changed, 316 insertions(+), 29 deletions(-)

diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
index 2b396a95cf0..51364bbdf82 100755
--- a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
+++ b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
@@ -33,6 +33,8 @@ curl "http://${ES_6_HOST}:9200/test2_20220808/doc/3"; -H 
"Content-Type:applicatio
 # put _meta for array
 curl "http://${ES_6_HOST}:9200/test1/doc/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
 curl "http://${ES_6_HOST}:9200/test2_20220808/doc/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
+# create index .hide
+curl "http://${ES_6_HOST}:9200/.hide"; -H "Content-Type:application/json" -X 
PUT -d "@/mnt/scripts/index/es6_hide.json"
 
 # es7
 # create index test1
@@ -58,6 +60,9 @@ curl "http://${ES_7_HOST}:9200/test3_20231005/_doc/1"; -H 
"Content-Type:applicati
 curl "http://${ES_7_HOST}:9200/test1/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
 curl "http://${ES_7_HOST}:9200/test2_20220808/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
 
+# create index .hide
+curl "http://${ES_7_HOST}:9200/.hide"; -H "Content-Type:application/json" -X 
PUT -d "@/mnt/scripts/index/es7_hide.json"
+
 # es8
 # create index test1
 curl "http://${ES_8_HOST}:9200/test1"; -H "Content-Type:application/json" -X 
PUT -d "@/mnt/scripts/index/es7_test1.json"
diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_hide.json 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_hide.json
new file mode 100644
index 00000000000..ac329fcf19f
--- /dev/null
+++ 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_hide.json
@@ -0,0 +1,88 @@
+{
+  "settings": {
+    "number_of_shards": 1,
+    "number_of_replicas": 0
+  },
+  "mappings": {
+    "doc": {
+      "properties": {
+        "test1": {
+          "type": "keyword"
+        },
+        "test2": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "test3": {
+          "type": "double"
+        },
+        "test4": {
+          "type": "date"
+        },
+        "test5": {
+          "type": "long"
+        },
+        "c_bool": {
+          "type": "boolean"
+        },
+        "c_byte": {
+          "type": "byte"
+        },
+        "c_short": {
+          "type": "short"
+        },
+        "c_integer": {
+          "type": "integer"
+        },
+        "c_long": {
+          "type": "long"
+        },
+        "c_float": {
+          "type": "float"
+        },
+        "c_half_float": {
+          "type": "half_float"
+        },
+        "c_double": {
+          "type": "double"
+        },
+        "c_scaled_float": {
+          "type": "scaled_float",
+          "scaling_factor": 0.01
+        },
+        "c_date": {
+          "type": "date",
+          "format": "yyyy-MM-dd"
+        },
+        "c_datetime": {
+          "type": "date",
+          "format": "yyyy-MM-dd HH:mm:ss"
+        },
+        "c_keyword": {
+          "type": "keyword"
+        },
+        "c_text": {
+          "type": "text"
+        },
+        "c_ip": {
+          "type": "ip"
+        },
+        "c_person": {
+          "properties": {
+            "name": {
+              "type": "keyword"
+            },
+            "age": {
+              "type": "integer"
+            }
+          }
+        }
+      }
+    }
+  }
+}
diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_hide.json 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_hide.json
new file mode 100644
index 00000000000..9ad548d48c1
--- /dev/null
+++ 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_hide.json
@@ -0,0 +1,104 @@
+{
+  "settings": {
+    "number_of_shards": 1,
+    "number_of_replicas": 0
+  },
+  "mappings": {
+    "properties": {
+      "test1": {
+        "type": "keyword"
+      },
+      "test2": {
+        "type": "text",
+        "fields": {
+          "keyword": {
+            "type": "keyword",
+            "ignore_above": 256
+          }
+        }
+      },
+      "test3": {
+        "type": "double"
+      },
+      "test4": {
+        "type": "date"
+      },
+      "test5": {
+        "type": "date",
+        "format": "yyyy-MM-dd HH:mm:ss"
+      },
+      "test6": {
+        "type": "date",
+        "format": "epoch_millis"
+      },
+      "test7": {
+        "type": "date",
+        "format": "yyyy-MM-dd HH:mm:ss || epoch_millis"
+      },
+      "test8": {
+        "type": "date"
+      },
+      "test9": {
+        "type": "long"
+      },
+      "c_bool": {
+        "type": "boolean"
+      },
+      "c_byte": {
+        "type": "byte"
+      },
+      "c_short": {
+        "type": "short"
+      },
+      "c_integer": {
+        "type": "integer"
+      },
+      "c_long": {
+        "type": "long"
+      },
+      "c_unsigned_long": {
+        "type": "unsigned_long"
+      },
+      "c_float": {
+        "type": "float"
+      },
+      "c_half_float": {
+        "type": "half_float"
+      },
+      "c_double": {
+        "type": "double"
+      },
+      "c_scaled_float": {
+        "type": "scaled_float",
+        "scaling_factor": 0.01
+      },
+      "c_date": {
+        "type": "date",
+        "format": "yyyy-MM-dd"
+      },
+      "c_datetime": {
+        "type": "date",
+        "format": "yyyy-MM-dd HH:mm:ss"
+      },
+      "c_keyword": {
+        "type": "keyword"
+      },
+      "c_text": {
+        "type": "text"
+      },
+      "c_ip": {
+        "type": "ip"
+      },
+      "c_person": {
+        "properties": {
+          "name": {
+            "type": "keyword"
+          },
+          "age": {
+            "type": "integer"
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/docs/en/docs/lakehouse/multi-catalog/es.md 
b/docs/en/docs/lakehouse/multi-catalog/es.md
index 6ce16a32046..c6293f931f9 100644
--- a/docs/en/docs/lakehouse/multi-catalog/es.md
+++ b/docs/en/docs/lakehouse/multi-catalog/es.md
@@ -50,17 +50,18 @@ After switching to the ES Catalog, you will be in the 
`dafault_db`  so you don't
 
 ### Parameter Description
 
-| Parameter         | Required or Not | Default Value | Description            
                                                                                
                                           |
-| ----------------- | --------------- | ------------- 
|---------------------------------------------------------------------------------------------------------------------------------------------------|
-| `hosts`           | Yes             |               | ES address, can be one 
or multiple addresses, or the load balancer address of ES                       
                                           |
-| `user`            | No              | Empty         | ES username            
                                                                                
                                           |
-| `password`        | No              | Empty         | Password of the 
corresponding user                                                              
                                                  |
-| `doc_value_scan`  | No              | true          | Whether to obtain 
value of the target field by ES/Lucene columnar storage                         
                                                |
-| `keyword_sniff`   | No              | true          | Whether to sniff the 
text.fields in ES based on keyword; If this is set to false, the system will 
perform matching after tokenization.            |
-| `nodes_discovery` | No              | true          | Whether to enable ES 
node discovery, set to true by default; set to false in network isolation 
environments and only connected to specified nodes |
-| `ssl`             | No              | false         | Whether to enable 
HTTPS access mode for ES, currently follows a "Trust All" method in FE/BE       
                                                |
-| `mapping_es_id`   | No              | false         | Whether to map the  
`_id`  field in the ES index                                                    
                                              |
-| `like_push_down`  | No              | true          | Whether to transform 
like to wildcard push down to es, this increases the cpu consumption of the es. 
                                             |
+| Parameter              | Required or Not | Default Value | Description       
                                           |
+| ---------------------- | --------------- | ------------- | 
------------------------------------------------------------ |
+| `hosts`                | Yes             |               | ES address, can 
be one or multiple addresses, or the load balancer address of ES |
+| `user`                 | No              | Empty         | ES username       
                                           |
+| `password`             | No              | Empty         | Password of the 
corresponding user                           |
+| `doc_value_scan`       | No              | true          | Whether to obtain 
value of the target field by ES/Lucene columnar storage |
+| `keyword_sniff`        | No              | true          | Whether to sniff 
the text.fields in ES based on keyword; If this is set to false, the system 
will perform matching after tokenization. |
+| `nodes_discovery`      | No              | true          | Whether to enable 
ES node discovery, set to true by default; set to false in network isolation 
environments and only connected to specified nodes |
+| `ssl`                  | No              | false         | Whether to enable 
HTTPS access mode for ES, currently follows a "Trust All" method in FE/BE |
+| `mapping_es_id`        | No              | false         | Whether to map 
the  `_id`  field in the ES index             |
+| `like_push_down`       | No              | true          | Whether to 
transform like to wildcard push down to es, this increases the cpu consumption 
of the es. |
+| `include_hidden_index` | No              | false         | Whether to 
include hidden index, default to false.           |
 
 > 1. In terms of authentication, only HTTP Basic authentication is supported 
 > and it requires the user to have read privilege for the index and paths 
 > including `/_cluster/state/` and `_nodes/http` ; if you have not enabled 
 > security authentication for the cluster, you don't need to set the  `user` 
 > and `password`.
 >
diff --git a/docs/zh-CN/docs/lakehouse/multi-catalog/es.md 
b/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
index 2fc4415c84d..64a12726f5c 100644
--- a/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
+++ b/docs/zh-CN/docs/lakehouse/multi-catalog/es.md
@@ -50,17 +50,18 @@ CREATE CATALOG es PROPERTIES (
 
 ### 参数说明
 
-参数 | 是否必须 | 默认值 | 说明                                                           
          
---- | --- | --- 
|------------------------------------------------------------------------
-`hosts` | 是 | | ES 地址,可以是一个或多个,也可以是 ES 的负载均衡地址                                 
        |
-`user` | 否 |  空 | ES 用户名                                                       
          |
-`password` | 否 | 空 | 对应用户的密码信息                                                 
             |
-`doc_value_scan` | 否 | true | 是否开启通过 ES/Lucene 列式存储获取查询字段的值                    
                      |
-`keyword_sniff` | 否 | true | 是否对 ES 中字符串分词类型 text.fields 进行探测,通过 keyword 
进行查询。设置为 false 会按照分词后的内容匹配 |
-`nodes_discovery` | 否 | true | 是否开启 ES 节点发现,默认为 true,在网络隔离环境下设置为 false,只连接指定节点 
                       |
-`ssl` | 否 | false | ES 是否开启 https 访问模式,目前在 fe/be 实现方式为信任所有                     
            |
-`mapping_es_id` | 否 | false | 是否映射 ES 索引中的 `_id` 字段                            
                      |
-`like_push_down` | 否 | true  | 是否将 like 转化为 wildchard 下推到 ES,会增加 ES cpu 消耗     
                       |
+| 参数                     | 是否必须 | 默认值   | 说明                                   
                                  |
+|------------------------|------|-------|------------------------------------------------------------------------|
+| `hosts`                | 是    |       | ES 地址,可以是一个或多个,也可以是 ES 的负载均衡地址       
                                  |
+| `user`                 | 否    | 空     | ES 用户名                               
                                  |
+| `password`             | 否    | 空     | 对应用户的密码信息                            
                                  |
+| `doc_value_scan`       | 否    | true  | 是否开启通过 ES/Lucene 列式存储获取查询字段的值        
                                  |
+| `keyword_sniff`        | 否    | true  | 是否对 ES 中字符串分词类型 text.fields 进行探测,通过 
keyword 进行查询。设置为 false 会按照分词后的内容匹配 |
+| `nodes_discovery`      | 否    | true  | 是否开启 ES 节点发现,默认为 true,在网络隔离环境下设置为 
false,只连接指定节点                        |
+| `ssl`                  | 否    | false | ES 是否开启 https 访问模式,目前在 fe/be 
实现方式为信任所有                                 |
+| `mapping_es_id`        | 否    | false | 是否映射 ES 索引中的 `_id` 字段                
                                  |
+| `like_push_down`       | 否    | true  | 是否将 like 转化为 wildchard 下推到 ES,会增加 ES 
cpu 消耗                            |
+| `include_hidden_index` | 否    | false | 是否包含隐藏的索引,默认为false。                  
                                  |
 
 > 1. 认证方式目前仅支持 Http Basic 认证,并且需要确保该用户有访问: `/_cluster/state/、_nodes/http` 等路径和 
 > index 的读权限; 集群未开启安全认证,用户名和密码不需要设置。
 > 
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 84f51cb820b..17fddb8cdee 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
@@ -64,6 +64,7 @@ public class EsResource extends Resource {
     public static final String LIKE_PUSH_DOWN = "like_push_down";
     public static final String QUERY_DSL = "query_dsl";
 
+    public static final String INCLUDE_HIDDEN_INDEX = "include_hidden_index";
     public static final String DOC_VALUE_SCAN_DEFAULT_VALUE = "true";
     public static final String KEYWORD_SNIFF_DEFAULT_VALUE = "true";
     public static final String HTTP_SSL_ENABLED_DEFAULT_VALUE = "false";
@@ -71,6 +72,8 @@ public class EsResource extends Resource {
     public static final String MAPPING_ES_ID_DEFAULT_VALUE = "false";
 
     public static final String LIKE_PUSH_DOWN_DEFAULT_VALUE = "true";
+
+    public static final String INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE = "false";
     @SerializedName(value = "properties")
     private Map<String, String> properties;
 
@@ -134,6 +137,9 @@ public class EsResource extends Resource {
         if (properties.containsKey(EsResource.LIKE_PUSH_DOWN)) {
             EsUtil.getBoolean(properties, EsResource.LIKE_PUSH_DOWN);
         }
+        if (properties.containsKey(EsResource.INCLUDE_HIDDEN_INDEX)) {
+            EsUtil.getBoolean(properties, EsResource.INCLUDE_HIDDEN_INDEX);
+        }
     }
 
     public static void fillUrlsWithSchema(String[] urls, boolean isSslEnabled) 
{
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsTable.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsTable.java
index b9dbc6ff645..a06da2af053 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsTable.java
@@ -37,7 +37,7 @@ import org.apache.logging.log4j.Logger;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -50,7 +50,7 @@ import java.util.Set;
 @Getter
 @Setter
 public class EsTable extends Table {
-    public static final Set<String> DEFAULT_DOCVALUE_DISABLED_FIELDS = new 
HashSet<>(Arrays.asList("text"));
+    public static final Set<String> DEFAULT_DOCVALUE_DISABLED_FIELDS = new 
HashSet<>(Collections.singletonList("text"));
 
     private static final Logger LOG = LogManager.getLogger(EsTable.class);
     // Solr doc_values vs stored_fields performance-smackdown indicate:
@@ -96,6 +96,9 @@ public class EsTable extends Table {
     // Whether pushdown like expr, like will trans to wildcard query, consumes 
too many es cpu resources
     private boolean likePushDown = 
Boolean.parseBoolean(EsResource.LIKE_PUSH_DOWN_DEFAULT_VALUE);
 
+    // Whether to include hidden index, default to false
+    private boolean includeHiddenIndex = 
Boolean.parseBoolean(EsResource.INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE);
+
     // tableContext is used for being convenient to persist some configuration 
parameters uniformly
     private Map<String, String> tableContext = new HashMap<>();
 
@@ -202,6 +205,10 @@ public class EsTable extends Table {
         // parse httpSslEnabled before use it here.
         EsResource.fillUrlsWithSchema(seeds, httpSslEnabled);
 
+        if 
(properties.containsKey(EsResource.INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE)) {
+            includeHiddenIndex = EsUtil.getBoolean(properties, 
EsResource.INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE);
+        }
+
         tableContext.put("hosts", hosts);
         tableContext.put("userName", userName);
         tableContext.put("passwd", passwd);
@@ -215,6 +222,7 @@ public class EsTable extends Table {
         tableContext.put(EsResource.NODES_DISCOVERY, 
String.valueOf(nodesDiscovery));
         tableContext.put(EsResource.HTTP_SSL_ENABLED, 
String.valueOf(httpSslEnabled));
         tableContext.put(EsResource.LIKE_PUSH_DOWN, 
String.valueOf(likePushDown));
+        tableContext.put(EsResource.INCLUDE_HIDDEN_INDEX, 
String.valueOf(includeHiddenIndex));
     }
 
     @Override
@@ -295,6 +303,8 @@ public class EsTable extends Table {
                 tableContext.getOrDefault(EsResource.HTTP_SSL_ENABLED, 
EsResource.HTTP_SSL_ENABLED_DEFAULT_VALUE));
         likePushDown = Boolean.parseBoolean(
                 tableContext.getOrDefault(EsResource.LIKE_PUSH_DOWN, 
EsResource.LIKE_PUSH_DOWN_DEFAULT_VALUE));
+        includeHiddenIndex = 
Boolean.parseBoolean(tableContext.getOrDefault(EsResource.INCLUDE_HIDDEN_INDEX,
+                EsResource.INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE));
         PartitionType partType = PartitionType.valueOf(Text.readString(in));
         if (partType == PartitionType.UNPARTITIONED) {
             partitionInfo = SinglePartitionInfo.read(in);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalTable.java
 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalTable.java
index 736b5745008..464fb79b8da 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalTable.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/external/EsExternalTable.java
@@ -97,6 +97,7 @@ public class EsExternalTable extends ExternalTable {
         esTable.setSeeds(esCatalog.getNodes());
         esTable.setHosts(String.join(",", esCatalog.getNodes()));
         esTable.syncTableMetaData();
+        esTable.setIncludeHiddenIndex(esCatalog.enableIncludeHiddenIndex());
         return esTable;
     }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/EsExternalCatalog.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/EsExternalCatalog.java
index 0ced7c1a6bc..847b49cf8ab 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/EsExternalCatalog.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/EsExternalCatalog.java
@@ -118,6 +118,11 @@ public class EsExternalCatalog extends ExternalCatalog {
                 EsResource.LIKE_PUSH_DOWN_DEFAULT_VALUE));
     }
 
+    public boolean enableIncludeHiddenIndex() {
+        return 
Boolean.parseBoolean(catalogProperty.getOrDefault(EsResource.INCLUDE_HIDDEN_INDEX,
+                EsResource.INCLUDE_HIDDEN_INDEX_DEFAULT_VALUE));
+    }
+
     @Override
     protected void initLocalObjectsImpl() {
         esRestClient = new EsRestClient(getNodes(), getUsername(), 
getPassword(), enableSsl());
@@ -136,7 +141,7 @@ public class EsExternalCatalog extends ExternalCatalog {
             db.getTables().forEach(table -> names.add(table.getName()));
             return names;
         } else {
-            return esRestClient.listTable();
+            return esRestClient.listTable(enableIncludeHiddenIndex());
         }
     }
 
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 057f18d2fc0..3ed68d74716 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
@@ -144,7 +144,7 @@ public class EsRestClient {
     /**
      * Get all index.
      **/
-    public List<String> getIndices() {
+    public List<String> getIndices(boolean includeHiddenIndex) {
         String indexes = 
execute("_cat/indices?h=index&format=json&s=index:asc");
         if (indexes == null) {
             throw new DorisEsException("get es indexes error");
@@ -154,9 +154,14 @@ public class EsRestClient {
         jsonNodes.forEach(json -> {
             // es 7.17 has .geoip_databases, but _mapping response 400.
             String index = json.get("index").asText();
-            if (!index.startsWith(".")) {
+            if (includeHiddenIndex) {
                 ret.add(index);
+            } else {
+                if (!index.startsWith(".")) {
+                    ret.add(index);
+                }
             }
+
         });
         return ret;
     }
@@ -186,8 +191,8 @@ public class EsRestClient {
     /**
      * Returns the merge of index and alias
      **/
-    public List<String> listTable() {
-        List<String> indices = 
getIndices().stream().distinct().collect(Collectors.toList());
+    public List<String> listTable(boolean includeHiddenIndex) {
+        List<String> indices = 
getIndices(includeHiddenIndex).stream().distinct().collect(Collectors.toList());
         getAliases().entrySet().stream().filter(e -> 
indices.contains(e.getKey())).flatMap(e -> e.getValue().stream())
                 .distinct().forEach(indices::add);
         return indices;
diff --git a/regression-test/suites/external_table_p0/es/test_es_query.groovy 
b/regression-test/suites/external_table_p0/es/test_es_query.groovy
index 379973f8c0b..660d81c97c5 100644
--- a/regression-test/suites/external_table_p0/es/test_es_query.groovy
+++ b/regression-test/suites/external_table_p0/es/test_es_query.groovy
@@ -57,6 +57,24 @@ suite("test_es_query", "p0") {
         );
         """
 
+        sql """create catalog if not exists es6_hide properties(
+            "type"="es",
+            "hosts"="http://${externalEnvIp}:$es_6_port";,
+            "nodes_discovery"="false",
+            "enable_keyword_sniff"="true",
+            "include_hidden_index"="true"
+        );
+        """
+
+        sql """create catalog if not exists es7_hide properties(
+            "type"="es",
+            "hosts"="http://${externalEnvIp}:$es_7_port";,
+            "nodes_discovery"="false",
+            "enable_keyword_sniff"="true",
+            "include_hidden_index"="true"
+        );
+        """
+
         // test external table for datetime
         sql """
             CREATE TABLE `test_v1` (
@@ -148,6 +166,26 @@ suite("test_es_query", "p0") {
         order_qt_sql67 """select * from test1 where esquery(test2, 
'{"match":{"test2":"text#1"}}')"""
         order_qt_sql68 """select c_bool, c_byte, c_short, c_integer, c_long, 
c_unsigned_long, c_float, c_half_float, c_double, c_scaled_float, c_date, 
c_datetime, c_keyword, c_text, c_ip, c_person from test1"""
         order_qt_sql69 """select c_bool, c_byte, c_short, c_integer, c_long, 
c_unsigned_long, c_float, c_half_float, c_double, c_scaled_float, c_date, 
c_datetime, c_keyword, c_text, c_ip, c_person from test2_20220808"""
+
+        List<List<String>> tables6N = sql """show tables"""
+        boolean notContainHide = true
+        tables6N.forEach {
+            if (it[0] == ".hide"){
+                notContainHide = false
+            }
+        }
+        assertTrue(notContainHide)
+
+        sql """switch es6_hide"""
+        List<List<String>> tables6Y = sql """show tables"""
+        boolean containHide = false
+        tables6Y.forEach {
+            if (it[0] == ".hide"){
+                containHide = true
+            }
+        }
+        assertTrue(containHide)
+
         sql """switch es7"""
         // order_qt_sql71 """show tables"""
         order_qt_sql72 """select * from test1 where test2='text#1'"""
@@ -158,7 +196,30 @@ suite("test_es_query", "p0") {
         order_qt_sql77 """select * from test1 where esquery(test2, 
'{"match":{"test2":"text#1"}}')"""
         order_qt_sql78 """select c_bool, c_byte, c_short, c_integer, c_long, 
c_unsigned_long, c_float, c_half_float, c_double, c_scaled_float, c_date, 
c_datetime, c_keyword, c_text, c_ip, c_person from test1"""
         order_qt_sql79 """select c_bool, c_byte, c_short, c_integer, c_long, 
c_unsigned_long, c_float, c_half_float, c_double, c_scaled_float, c_date, 
c_datetime, c_keyword, c_text, c_ip, c_person from test2"""
+
+
+        List<List<String>> tables7N = sql """show tables"""
+        boolean notContainHide7 = true
+        tables7N.forEach {
+            if (it[0] == ".hide"){
+                notContainHide7 = false
+            }
+        }
+        assertTrue(notContainHide7)
+
+        sql """switch es7_hide"""
+        List<List<String>> tables7Y = sql """show tables"""
+        boolean containeHide7 = false
+        tables7Y.forEach {
+            if (it[0] == (".hide")){
+                containeHide7 = true
+            }
+        }
+        assertTrue(containeHide7)
+
+
         order_qt_sql710 """select * from test3_20231005"""
+
         sql """switch es8"""
         order_qt_sql81 """select * from test1 where test2='text#1'"""
         order_qt_sql82 """select * from test2_20220808 where test4 >= 
'2022-08-08 00:00:00' and test4 < '2022-08-08 23:59:59'"""


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to