MCPcopy Index your code
hub / github.com/TruthHun/DocHub / ping

Method ping

models/ElasticSearchModel.go:438–448  ·  view source on GitHub ↗

检验es服务能否连通

()

Source from the content-addressed store, hash-verified

436
437//检验es服务能否连通
438func (this *ElasticSearchClient) ping() error {
439 resp, err := this.get(this.Host).Response()
440 if err != nil {
441 return err
442 }
443 if resp.StatusCode >= 300 || resp.StatusCode < 200 {
444 body, _ := ioutil.ReadAll(resp.Body)
445 err = errors.New(resp.Status + ";" + string(body))
446 }
447 return err
448}
449
450//查询索引是否存在
451//@return err nil表示索引存在,否则表示不存在

Callers 1

InitMethod · 0.95

Calls 2

getMethod · 0.95
ResponseMethod · 0.80

Tested by

no test coverage detected