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

   ### 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
   
   master 
   
   ### What's Wrong?
   
   
![image](https://github.com/apache/doris/assets/26450235/72539602-8582-4f50-81e3-32fe17661cef)
   
   
   ### What You Expected?
   
   Get correct result.
   
   ### How to Reproduce?
   
   ``` 
   docker run  --name your_container_name -p 80:80 -e 
"discovery.type=single-node"  --net=host  -e "ES_JAVA_OPTS=-Xms512m -Xmx512m"  
-d elasticsearch:7.8.0 
   ```
   创建index:
   ```
   curl "http://127.0.0.1:9200/test_index"; -H "Content-Type:application/json" 
-X PUT -d '{
     "settings": {
       "number_of_shards": 1,
       "number_of_replicas": 0
     },
     "mappings": {
       "properties": {
         "device_id": {
           "type": "text"
         },
         "report_time": {
           "type": "long"
         },
         "company_id": {
           "type": "text"
         },
         "status": {
           "type": "text"
         },
         "user_name": {
           "type": "text"
         }
       }
     }
   }'
   ```
   导入数据到es:
   ```
   curl "http://127.0.0.1:9200/test_index/_doc/1"; -H 
"Content-Type:application/json" -X POST -d '{
       "company_id": 0,
       "device_id": "abc",
       "report_time": 1692892810,
       "status": "LOGIN",
       "user_name": "A52C86027FCF3E44719C62E1EB4E30CDDC403464"
   }' 
   ```
   在doris中创建catalog:
   ```
   CREATE CATALOG es PROPERTIES (    "type"="es",    
"hosts"="http://127.0.0.1:9200";); 
   ```
   在doris中建表:
   ```
   CREATE TABLE `test_es` ( device_id varchar(50), report_time bigint, 
company_id varchar(10), user_name varchar(50))
   ENGINE=OLAP duplicate KEY (device_id)
   DISTRIBUTED BY HASH(device_id) BUCKETS 1
   PROPERTIES ( "replication_allocation" = "tag.location.default: 1"); 
   ```
   查询es catalog,并将数据写入doris:
   ```
   select device_id, report_time, company_id, user_name from 
es.default_db.test_index where report_time >= unix_timestamp('2023-07-01') and 
status = 'LOGIN'; 
   ```
   
   ### 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: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to