elastic: Error 404 (Not Found): no such index [dating_profile] [type=index_not_found_exception]
函数代码为:
func (h SearchResultHandler) getSearchResult(q string, from int) (model.SearchResult, error) {
var result model.SearchResult
resp, err := h.client.Search("dating_profile").Query(elastic.NewQueryStringQuery(q)).
From(from).
Do(context.Background())
if err != nil {
return result, err
}
result.Hits = resp.TotalHits()
result.Start = from
result.Items = resp.Each(reflect.TypeOf(engine.Item{}))
return result, nil
}