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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 9e327e877bc [test](ES Catalog)Add mapping _routing test case (#42074) 
(#42284)
9e327e877bc is described below

commit 9e327e877bc2ddaf435aa9bcd610840060e580b5
Author: qiye <jianliang5...@gmail.com>
AuthorDate: Tue Nov 5 10:51:40 2024 +0800

    [test](ES Catalog)Add mapping _routing test case (#42074) (#42284)
    
    ## Proposed changes
    
    bp #42074
---
 .../elasticsearch/scripts/es_init.sh               | 14 ++++++++---
 .../elasticsearch/scripts/index/es6_test3.json     | 27 ++++++++++++++++++++++
 .../elasticsearch/scripts/index/es7_test3.json     |  3 +++
 .../data/external_table_p0/es/test_es_query.out    | 12 ++++++++++
 .../external_table_p0/es/test_es_query.groovy      |  2 ++
 5 files changed, 55 insertions(+), 3 deletions(-)

diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
index 0e0d5a96d3a..d6bbeb7ff3b 100755
--- a/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
+++ b/docker/thirdparties/docker-compose/elasticsearch/scripts/es_init.sh
@@ -48,6 +48,8 @@ curl "http://${ES_5_HOST}:9200/test1"; -H 
"Content-Type:application/json" -X PUT
 curl "http://${ES_5_HOST}:9200/test2_20220808"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test2.json'
 # create index test2_20220809
 curl "http://${ES_5_HOST}:9200/test2_20220809"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test2.json'
+# create index test3_20231005
+curl "http://${ES_5_HOST}:9200/test3_20231005"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test3.json'
 # put data for test1
 curl "http://${ES_5_HOST}:9200/test1/doc/1"; -H "Content-Type:application/json" 
-X POST -d '@/mnt/scripts/data/data1_es6.json'
 curl "http://${ES_5_HOST}:9200/test1/doc/2"; -H "Content-Type:application/json" 
-X POST -d '@/mnt/scripts/data/data2_es6.json'
@@ -62,6 +64,8 @@ curl "http://${ES_5_HOST}:9200/test2_20220808/doc/3"; -H 
"Content-Type:applicatio
 curl "http://${ES_5_HOST}:9200/test2_20220809/doc/1"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data1_es6.json'
 curl "http://${ES_5_HOST}:9200/test2_20220809/doc/2"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data2_es6.json'
 curl "http://${ES_5_HOST}:9200/test2_20220809/doc/3"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data3_es5.json'
+# put data for test3_20231005
+curl "http://${ES_5_HOST}:9200/test3_20231005/doc/1?routing=my_routing_value"; 
-H "Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
 # put _meta for array
 curl "http://${ES_5_HOST}:9200/test1/doc/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
 curl "http://${ES_5_HOST}:9200/test2_20220808/doc/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
@@ -85,6 +89,8 @@ curl "http://${ES_6_HOST}:9200/test1"; -H 
"Content-Type:application/json" -X PUT
 curl "http://${ES_6_HOST}:9200/test2_20220808"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test2.json'
 # create index test2_20220809
 curl "http://${ES_6_HOST}:9200/test2_20220809"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test2.json'
+# create index test3_20231005
+curl "http://${ES_6_HOST}:9200/test3_20231005"; -H 
"Content-Type:application/json" -X PUT -d '@/mnt/scripts/index/es6_test3.json'
 # put data for test1
 curl "http://${ES_6_HOST}:9200/test1/doc/1"; -H "Content-Type:application/json" 
-X POST -d '@/mnt/scripts/data/data1_es6.json'
 curl "http://${ES_6_HOST}:9200/test1/doc/2"; -H "Content-Type:application/json" 
-X POST -d '@/mnt/scripts/data/data2_es6.json'
@@ -98,6 +104,8 @@ curl "http://${ES_6_HOST}:9200/test2_20220808/doc/3"; -H 
"Content-Type:applicatio
 curl "http://${ES_6_HOST}:9200/test2_20220809/doc/1"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data1_es6.json'
 curl "http://${ES_6_HOST}:9200/test2_20220809/doc/2"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data2_es6.json'
 curl "http://${ES_6_HOST}:9200/test2_20220809/doc/3"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data3_es6.json'
+# put data for test3_20231005
+curl "http://${ES_6_HOST}:9200/test3_20231005/doc/1?routing=my_routing_value"; 
-H "Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
 # 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"
@@ -139,7 +147,7 @@ curl "http://${ES_7_HOST}:9200/test2_20220809/_doc/2"; -H 
"Content-Type:applicati
 curl "http://${ES_7_HOST}:9200/test2_20220809/_doc/3"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data3.json'
 curl "http://${ES_7_HOST}:9200/test2_20220809/_doc/4"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data4.json'
 # put data for test3_20231005
-curl "http://${ES_7_HOST}:9200/test3_20231005/_doc/1"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
+curl "http://${ES_7_HOST}:9200/test3_20231005/_doc/1?routing=my_routing_value"; 
-H "Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
 
 # put _meta for array
 curl "http://${ES_7_HOST}:9200/test1/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
@@ -185,7 +193,7 @@ curl "http://${ES_8_HOST}:9200/test2_20220809/_doc/2"; -H 
"Content-Type:applicati
 curl "http://${ES_8_HOST}:9200/test2_20220809/_doc/3"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data3.json'
 curl "http://${ES_8_HOST}:9200/test2_20220809/_doc/4"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data4.json'
 # put data for test3_20231005
-curl "http://${ES_8_HOST}:9200/test3_20231005/_doc/1"; -H 
"Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
+curl "http://${ES_8_HOST}:9200/test3_20231005/_doc/1?routing=my_routing_value"; 
-H "Content-Type:application/json" -X POST -d '@/mnt/scripts/data/data6.json'
 
 # put _meta for array
 curl "http://${ES_8_HOST}:9200/test1/_mapping"; -H 
"Content-Type:application/json" -X PUT -d "@/mnt/scripts/index/array_meta.json"
@@ -199,4 +207,4 @@ bulk_request_file="/mnt/scripts/data/bulk_request_es8.json"
 generate_bulk_request "composite_type_array" "" "item_" "$array_data_file" 
"$bulk_request_file"
 curl -X POST "http://${ES_8_HOST}:9200/_bulk"; --data-binary 
"@$bulk_request_file" -H "Content-Type: application/json"
 # put _meta for composite_type_array
-curl "http://${ES_8_HOST}:9200/composite_type_array/_mapping"; -H 
"Content-Type:application/json" -X PUT -d 
"@/mnt/scripts/index/array_meta_composite_type_array.json"
\ No newline at end of file
+curl "http://${ES_8_HOST}:9200/composite_type_array/_mapping"; -H 
"Content-Type:application/json" -X PUT -d 
"@/mnt/scripts/index/array_meta_composite_type_array.json"
diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_test3.json 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_test3.json
new file mode 100644
index 00000000000..fe9b99bde53
--- /dev/null
+++ 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es6_test3.json
@@ -0,0 +1,27 @@
+{
+  "settings": {
+    "number_of_shards": 1,
+    "number_of_replicas": 0
+  },
+  "mappings": {
+    "doc": {
+      "dynamic": "true",
+      "dynamic_date_formats": [
+        "strict_date_optional_time",
+        "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
+      ],
+      "dynamic_templates": [
+  
+      ],
+      "date_detection": true,
+      "numeric_detection": false,
+      "_routing": {
+        "required": true
+      },
+      "properties": {
+        "field1": { "type": "text" },
+        "field2": { "type": "keyword" }
+      }
+    }
+  }
+}
diff --git 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_test3.json 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_test3.json
index a8fa73b1b36..3e1079bec1a 100644
--- 
a/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_test3.json
+++ 
b/docker/thirdparties/docker-compose/elasticsearch/scripts/index/es7_test3.json
@@ -14,6 +14,9 @@
     ],
     "date_detection": true,
     "numeric_detection": false,
+    "_routing": {
+      "required": true
+    },
     "properties": {
       "field1": { "type": "text" },
       "field2": { "type": "keyword" }
diff --git a/regression-test/data/external_table_p0/es/test_es_query.out 
b/regression-test/data/external_table_p0/es/test_es_query.out
index 9b9cabd4cea..6d761babed7 100644
--- a/regression-test/data/external_table_p0/es/test_es_query.out
+++ b/regression-test/data/external_table_p0/es/test_es_query.out
@@ -217,6 +217,9 @@ Grace       [34, 56, 78]    ["table tennis", "badminton", 
"athletics"]
 Henry  [23, 45, 67]    ["archery", "fencing", "weightlifting"]
 Ivy    [12, 34, 56]    ["judo", "karate", "taekwondo"]
 
+-- !sql_5_28 --
+value1 value2
+
 -- !sql_6_02 --
 [1, 0, 1, 1]   [1, -2, -3, 4]  ["2020-01-01", "2020-01-02"]    ["2020-01-01 
12:00:00", "2020-01-02 13:01:01"]  [1, 2, 3, 4]    [1, 1.1, 1.2, 1.3]      [1, 
2, 3, 4]    [32768, 32769, -32769, -32770]  ["192.168.0.1", "127.0.0.1"]    
["a", "b", "c"] [-1, 0, 1, 2]   
[{"name":"Andy","age":18},{"name":"Tim","age":28}]      [1, 2, 3, 4]    [128, 
129, -129, -130]  ["d", "e", "f"] [0, 1, 2, 3]    
[{"last":"Smith","first":"John"},{"last":"White","first":"Alice"}]      \N      
string1 text#1  3.14    2022-08-08T00:00        12345   2022-08-08T20:10:10
 
@@ -343,6 +346,9 @@ Grace       [34, 56, 78]    ["table tennis", "badminton", 
"athletics"]
 Henry  [23, 45, 67]    ["archery", "fencing", "weightlifting"]
 Ivy    [12, 34, 56]    ["judo", "karate", "taekwondo"]
 
+-- !sql_6_28 --
+value1 value2
+
 -- !sql_7_02 --
 [1, 0, 1, 1]   [1, -2, -3, 4]  ["2020-01-01", "2020-01-02"]    ["2020-01-01 
12:00:00", "2020-01-02 13:01:01"]  [1, 2, 3, 4]    [1, 1.1, 1.2, 1.3]      [1, 
2, 3, 4]    [32768, 32769, -32769, -32770]  ["192.168.0.1", "127.0.0.1"]    
["a", "b", "c"] [-1, 0, 1, 2]   
[{"name":"Andy","age":18},{"name":"Tim","age":28}]      [1, 2, 3, 4]    [128, 
129, -129, -130]  ["d", "e", "f"] [0, 1, 2, 3]    
[{"last":"Smith","first":"John"},{"last":"White","first":"Alice"}]      debug   
\N      This string can be quite lengthy        string1 2022-08-08T20:10:10     
 [...]
 
@@ -897,6 +903,9 @@ Grace       [34, 56, 78]    ["table tennis", "badminton", 
"athletics"]
 Henry  [23, 45, 67]    ["archery", "fencing", "weightlifting"]
 Ivy    [12, 34, 56]    ["judo", "karate", "taekwondo"]
 
+-- !sql_5_28 --
+value1 value2
+
 -- !sql_6_02 --
 [1, 0, 1, 1]   [1, -2, -3, 4]  ["2020-01-01", "2020-01-02"]    ["2020-01-01 
12:00:00", "2020-01-02 13:01:01"]  [1, 2, 3, 4]    [1, 1.1, 1.2, 1.3]      [1, 
2, 3, 4]    [32768, 32769, -32769, -32770]  ["192.168.0.1", "127.0.0.1"]    
["a", "b", "c"] [-1, 0, 1, 2]   
[{"name":"Andy","age":18},{"name":"Tim","age":28}]      [1, 2, 3, 4]    [128, 
129, -129, -130]  ["d", "e", "f"] [0, 1, 2, 3]    
[{"last":"Smith","first":"John"},{"last":"White","first":"Alice"}]      \N      
string1 text#1  3.14    2022-08-08T00:00        12345   2022-08-08T20:10:10
 
@@ -1023,6 +1032,9 @@ Grace     [34, 56, 78]    ["table tennis", "badminton", 
"athletics"]
 Henry  [23, 45, 67]    ["archery", "fencing", "weightlifting"]
 Ivy    [12, 34, 56]    ["judo", "karate", "taekwondo"]
 
+-- !sql_6_28 --
+value1 value2
+
 -- !sql_7_02 --
 [1, 0, 1, 1]   [1, -2, -3, 4]  ["2020-01-01", "2020-01-02"]    ["2020-01-01 
12:00:00", "2020-01-02 13:01:01"]  [1, 2, 3, 4]    [1, 1.1, 1.2, 1.3]      [1, 
2, 3, 4]    [32768, 32769, -32769, -32770]  ["192.168.0.1", "127.0.0.1"]    
["a", "b", "c"] [-1, 0, 1, 2]   
[{"name":"Andy","age":18},{"name":"Tim","age":28}]      [1, 2, 3, 4]    [128, 
129, -129, -130]  ["d", "e", "f"] [0, 1, 2, 3]    
[{"last":"Smith","first":"John"},{"last":"White","first":"Alice"}]      debug   
\N      This string can be quite lengthy        string1 2022-08-08T20:10:10     
 [...]
 
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 872c465e96b..d2478aeadd2 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
@@ -213,6 +213,7 @@ suite("test_es_query", 
"p0,external,es,external_docker,external_docker_es") {
             order_qt_sql_5_25 """select test6 from test1;"""
             order_qt_sql_5_26 """select test6 from test2;"""
             order_qt_sql_5_27 """select * from composite_type_array order by 
name;"""
+            order_qt_sql_5_28 """select * from test3_20231005;"""
 
             sql """switch test_es_query_es6"""
             // order_qt_sql_6_01 """show tables"""
@@ -242,6 +243,7 @@ suite("test_es_query", 
"p0,external,es,external_docker,external_docker_es") {
             order_qt_sql_6_25 """select test6 from test1;"""
             order_qt_sql_6_26 """select test6 from test2;"""
             order_qt_sql_6_27 """select * from composite_type_array order by 
name;"""
+            order_qt_sql_6_28 """select * from test3_20231005;"""
 
             List<List<String>> tables6N = sql """show tables"""
             boolean notContainHide = true


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to