qidaye opened a new pull request, #40444:
URL: https://github.com/apache/doris/pull/40444

   ## Proposed changes
   
   Add api to get info from Elasticsearch, it's very useful for debugging.
   1. get index mapping api
   ```
   curl -XGET 
'10.16.10.6:8137/rest/v2/api/es/get_mapping?catalog=test_es_query_es8&table=test1'
   {
     "msg": "success",
     "code": 0,
     "data": {
       "result": {
         "test1": {
           "mappings": {
             "_meta": {
               "doris": {
                 "array_fields": [
                   "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"
                 ]
               }
             },
             "properties": {
               "c_bool": {
                 "type": "boolean"
               },
               "c_byte": {
                 "type": "byte"
               },
               "c_date": {
                 "type": "date",
                 "format": "yyyy-MM-dd"
               },
               "c_datetime": {
                 "type": "date",
                 "format": "yyyy-MM-dd HH:mm:ss"
               },
               "c_double": {
                 "type": "double"
               },
               "c_float": {
                 "type": "float"
               },
               "c_half_float": {
                 "type": "half_float"
               },
               "c_integer": {
                 "type": "integer"
               },
               "c_ip": {
                 "type": "ip"
               },
               "c_keyword": {
                 "type": "keyword"
               },
               "c_long": {
                 "type": "long"
               },
               "c_person": {
                 "properties": {
                   "age": {
                     "type": "integer"
                   },
                   "name": {
                     "type": "keyword"
                   }
                 }
               },
               "c_scaled_float": {
                 "type": "scaled_float",
                 "scaling_factor": 0.01
               },
               "c_short": {
                 "type": "short"
               },
               "c_text": {
                 "type": "text"
               },
               "c_unsigned_long": {
                 "type": "unsigned_long"
               },
               "c_user": {
                 "type": "nested",
                 "properties": {
                   "first": {
                     "type": "text",
                     "fields": {
                       "keyword": {
                         "type": "keyword",
                         "ignore_above": 256
                       }
                     }
                   },
                   "last": {
                     "type": "text",
                     "fields": {
                       "keyword": {
                         "type": "keyword",
                         "ignore_above": 256
                       }
                     }
                   }
                 }
               },
               "level": {
                 "type": "constant_keyword",
                 "value": "debug"
               },
               "message": {
                 "type": "text",
                 "fields": {
                   "keyword": {
                     "type": "keyword",
                     "ignore_above": 256
                   }
                 }
               },
               "my_wildcard": {
                 "type": "wildcard"
               },
               "test1": {
                 "type": "keyword"
               },
               "test10": {
                 "type": "date"
               },
               "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"
               }
             }
           }
         }
       },
       "catalog": "test_es_query_es8",
       "table": "test1"
     },
     "count": 0
   }
   ```
   2. search index api
   ```
    curl -sXPOST 
'10.16.10.6:8137/rest/v2/api/es/search?catalog=test_es_query_es8&table=test1' 
-H'Content-Type:application/json' 
-d'{"query":{"match_all":{}},"stored_fields":"_none_","docvalue_fields":["test6"],"sort":["_doc"],"size":4064}'
   {
     "msg": "success",
     "code": 0,
     "data": {
       "result": {
         "took": 2,
         "timed_out": false,
         "_shards": {
           "total": 1,
           "successful": 1,
           "skipped": 0,
           "failed": 0
         },
         "hits": {
           "total": {
             "value": 4,
             "relation": "eq"
           },
           "max_score": null,
           "hits": [
             {
               "_index": "test1",
               "_score": null,
               "fields": {
                 "test6": [
                   "1659931810000"
                 ]
               },
               "sort": [
                 2
               ]
             },
             {
               "_index": "test1",
               "_score": null,
               "fields": {
                 "test6": [
                   "1660018210000"
                 ]
               },
               "sort": [
                 5
               ]
             },
             {
               "_index": "test1",
               "_score": null,
               "fields": {
                 "test6": [
                   "1660104610000"
                 ]
               },
               "sort": [
                 8
               ]
             },
             {
               "_index": "test1",
               "_score": null,
               "fields": {
                 "test6": [
                   "1660191010000"
                 ]
               },
               "sort": [
                 11
               ]
             }
           ]
         }
       },
       "catalog": "test_es_query_es8",
       "table": "test1"
     },
     "count": 0
   }
   ```
   
   


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