BePPPower commented on PR #13027:
URL: https://github.com/apache/doris/pull/13027#issuecomment-1263708963

   > Can you provide some test info? Such as query es result in your local 
environment.
   
   Hi, here is my test in local environment:
   ```
   // create es index
   curl -X PUT -H 'Content-Type: application/json' 'localhost:9285/test' -d '
   {
      "settings": {
         "index": {
            "number_of_shards": "1",
            "number_of_replicas": "0"
         }
      },
      "mappings": {
        "properties": {
           "k1": {
              "type": "long"
           },
           "k2": {
              "type": "date"
           },
           "k3": {
              "type": "keyword"
           },
           "k4": {
              "type": "text",
              "analyzer": "standard"
           },
           "k5": {
              "type": "float"
           }
        }
      }
   }'
   ```
   And I had inserted thousands of  docs into es. 
   Create statements in doris:
   ```
   CREATE EXTERNAL TABLE `ftw_es` (
     `k1` bigint(20) COMMENT "",
     `k2` datetime COMMENT "",
     `k3` varchar(20) COMMENT "",
     `k4` varchar(100) COMMENT "",
     `k5` float COMMENT ""
   ) ENGINE=ELASTICSEARCH
   PROPERTIES (
   "hosts" = "http://127.0.0.1:9285";,
   "index" = "test",
   "type" = "_doc",
   "user" = "root",
   "password" = "root"
   );
   ```
   **query statements**
   ```
   MySQL [demo]> select count(*) from ftw_es;
   +----------+
   | count(*) |
   +----------+
   |     5268 |
   +----------+
   
   MySQL [demo]> select * from ftw_es where esquery(k4, '{
       "match_phrase": {
          "k4": "doris on es"
       }
   }');
   +------+---------------------+-------------+-------------+------+
   | k1   | k2                  | k3          | k4          | k5   |
   +------+---------------------+-------------+-------------+------+
   |  100 | 2020-01-01 00:00:00 | Doris On ES | Doris On ES |   10 |
   +------+---------------------+-------------+-------------+------+
   
   MySQL [demo]> select * from ftw_es where esquery(k4, '{
       "match_phrase": {
          "k4": "abc"
       }
   }') limit 5;
   +------+---------------------+------+---------+-------+
   | k1   | k2                  | k3   | k4      | k5    |
   +------+---------------------+------+---------+-------+
   |  105 | 2020-01-05 00:00:00 | zzz  | zzz abc | 14.24 |
   |  105 | 2020-01-05 00:00:00 | zzz  | zzz abc | 14.24 |
   |  105 | 2020-01-05 00:00:00 | zzz  | zzz abc | 14.24 |
   |  105 | 2020-01-05 00:00:00 | zzz  | zzz abc | 14.24 |
   |  105 | 2020-01-05 00:00:00 | zzz  | zzz abc | 14.24 |
   +------+---------------------+------+---------+-------+
   
   MySQL [demo]> select * from ftw_es where k5<14;
   
+------+---------------------+--------------------------+--------------------------+------+
   | k1   | k2                  | k3                       | k4                 
      | k5   |
   
+------+---------------------+--------------------------+--------------------------+------+
   |  100 | 2020-01-01 00:00:00 | Trying out Elasticsearch | Trying out 
Elasticsearch |   10 |
   |  100 | 2020-01-01 00:00:00 | Doris On ES              | Doris On ES        
      |   10 |
   |  100 | 2020-01-01 00:00:00 | Doris                    | Doris              
      |   10 |
   |  100 | 2020-01-01 00:00:00 | ES                       | ES                 
      |   10 |
   |  101 | 2020-01-02 00:00:00 | FTW                      | FTW                
      |   11 |
   |  102 | 2020-01-03 00:00:00 | CYX                      | CYX                
      |   12 |
   |  103 | 2020-01-04 00:00:00 | XXX                      | CYX XXX            
      |   13 |
   
+------+---------------------+--------------------------+--------------------------+------+
   ```


-- 
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

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