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

Method DeleteIndex

models/ElasticSearchModel.go:424–435  ·  view source on GitHub ↗

删除索引 @param id 索引id @return err 错误

(id int)

Source from the content-addressed store, hash-verified

422//@param id 索引id
423//@return err 错误
424func (this *ElasticSearchClient) DeleteIndex(id int) (err error) {
425 api := this.Host + this.Index + "/" + this.Type + "/" + strconv.Itoa(id)
426 if resp, errResp := this.delete(api).Response(); errResp != nil {
427 err = errResp
428 } else {
429 if resp.StatusCode >= 300 || resp.StatusCode < 200 {
430 b, _ := ioutil.ReadAll(resp.Body)
431 err = errors.New("删除索引失败:" + resp.Status + ";" + string(b))
432 }
433 }
434 return
435}
436
437//检验es服务能否连通
438func (this *ElasticSearchClient) ping() error {

Callers 1

RemoveToRecycleMethod · 0.95

Calls 2

deleteMethod · 0.95
ResponseMethod · 0.80

Tested by

no test coverage detected