MCPcopy Create free account
hub / github.com/TruthHun/DocHub / createIndex

Method createIndex

models/ElasticSearchModel.go:466–476  ·  view source on GitHub ↗

创建索引 @return err 创建索引

()

Source from the content-addressed store, hash-verified

464//创建索引
465//@return err 创建索引
466func (this *ElasticSearchClient) createIndex() (err error) {
467 var resp *http.Response
468 api := this.Host + this.Index
469 if resp, err = this.put(api).Response(); err == nil {
470 if resp.StatusCode >= 300 || resp.StatusCode < 200 {
471 b, _ := ioutil.ReadAll(resp.Body)
472 err = errors.New(resp.Status + ":" + string(b))
473 }
474 }
475 return
476}
477
478//put请求
479func (this *ElasticSearchClient) put(api string) (req *httplib.BeegoHTTPRequest) {

Callers 1

InitMethod · 0.95

Calls 2

putMethod · 0.95
ResponseMethod · 0.80

Tested by

no test coverage detected