qidaye opened a new issue, #14651:
URL: https://github.com/apache/doris/issues/14651

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   `8d1d144eedf645cb394ebed638ae75fc7ce81edf`
   
   ### What's Wrong?
   
   Can not query es external table when FE is restarted.
   ES query dsl is wrong.
   ```
   MySQL [(none)]> explain select * from test2 where 
session_id='cc395f3d4af6476c9e20aad75c48d00d' and biz_type='YXS';
   
+------------------------------------------------------------------------------------------------------------------------------------+
   | Explain String                                                             
                                                        |
   
+------------------------------------------------------------------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                            
                                                        |
   |   OUTPUT EXPRS:                                                            
                                                        |
   |     `es`.`default_cluster:default_db`.`test2`.`biz_type`                   
                                                        |
   |     `es`.`default_cluster:default_db`.`test2`.`session_id`                 
                                                        |
   |   PARTITION: UNPARTITIONED                                                 
                                                        |
   |                                                                            
                                                        |
   |   VRESULT SINK                                                             
                                                        |
   |                                                                            
                                                        |
   |   1:VEXCHANGE                                                              
                                                        |
   |                                                                            
                                                        |
   | PLAN FRAGMENT 1                                                            
                                                        |
   |                                                                            
                                                        |
   |   PARTITION: RANDOM                                                        
                                                        |
   |                                                                            
                                                        |
   |   STREAM DATA SINK                                                         
                                                        |
   |     EXCHANGE ID: 01                                                        
                                                        |
   |     UNPARTITIONED                                                          
                                                        |
   |                                                                            
                                                        |
   |   0:VEsScanNode                                                            
                                                        |
   |      TABLE: test2                                                          
                                                        |
   |      REMOTE_PREDICATES: 
{"bool":{"must":[{"term":{"session_id":"cc395f3d4af6476c9e20aad75c48d00d"}},{"term":{"biz_type":"YXS"}}]}}
 |
   |      ES index/type: test2/null                                             
                                                        |
   
+------------------------------------------------------------------------------------------------------------------------------------+
   ```
   
   ### What You Expected?
   
   Query normal.
   ```
   MySQL [(none)]> explain select * from test2 where 
session_id='cc395f3d4af6476c9e20aad75c48d00d' and biz_type='YXS';
   
+----------------------------------------------------------------------------------------------------------------------------------------------------+
   | Explain String                                                             
                                                                        |
   
+----------------------------------------------------------------------------------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                            
                                                                        |
   |   OUTPUT EXPRS:                                                            
                                                                        |
   |     `es`.`default_cluster:default_db`.`test2`.`biz_type`                   
                                                                        |
   |     `es`.`default_cluster:default_db`.`test2`.`session_id`                 
                                                                        |
   |   PARTITION: UNPARTITIONED                                                 
                                                                        |
   |                                                                            
                                                                        |
   |   VRESULT SINK                                                             
                                                                        |
   |                                                                            
                                                                        |
   |   1:VEXCHANGE                                                              
                                                                        |
   |                                                                            
                                                                        |
   | PLAN FRAGMENT 1                                                            
                                                                        |
   |                                                                            
                                                                        |
   |   PARTITION: RANDOM                                                        
                                                                        |
   |                                                                            
                                                                        |
   |   STREAM DATA SINK                                                         
                                                                        |
   |     EXCHANGE ID: 01                                                        
                                                                        |
   |     UNPARTITIONED                                                          
                                                                        |
   |                                                                            
                                                                        |
   |   0:VEsScanNode                                                            
                                                                        |
   |      TABLE: test2                                                          
                                                                        |
   |      REMOTE_PREDICATES: 
{"bool":{"must":[{"term":{"session_id.keyword":"cc395f3d4af6476c9e20aad75c48d00d"}},{"term":{"biz_type.keyword":"YXS"}}]}}
 |
   |      ES index/type: test2/null                                             
                                                                        |
   
+----------------------------------------------------------------------------------------------------------------------------------------------------+
   ```
   
   ### How to Reproduce?
   
   1. create es index
   ```
   curl -X PUT "localhost:9200/test2?pretty" -H 'Content-Type: 
application/json' -d'
   {
     "mappings": {
       "_doc": { 
         "properties": { 
           "session_id": {
             "type": "text",
             "fields": {
               "keyword": {
                 "ignore_above": 256,
                 "type": "keyword"
               }
             }
           },
           "biz_type": {
             "type": "text",
             "fields": {
               "keyword": {
                 "ignore_above": 256,
                 "type": "keyword"
               }
             }
           }
         }
       }
     }
   }
   '
   
   curl -X PUT "localhost:9200/test2/_doc/1?pretty" -H 'Content-Type: 
application/json' -d'
   {
       "session_id" : "cc395f3d4af6476c9e20aad75c48d00d",
       "biz_type": "YXS"
   }
   '
   ```
   2. create es external catalog in Doris
   ```
   CREATE CATALOG es PROPERTIES (
        "type"="es",
        "elasticsearch.hosts"="http://127.0.0.1:9200";,
        "elasticsearch.nodes_discovery"="false"
   );
   ```
   3. query table
   ```
   explain select * from test2 where 
session_id='cc395f3d4af6476c9e20aad75c48d00d' and biz_type='YXS';
   ```
   4. restarted FE 
   5. query table 
   ```
   explain select * from test2 where 
session_id='cc395f3d4af6476c9e20aad75c48d00d' and biz_type='YXS';
   ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to