package elasticsearch import "encoding/json" // ErrorResponse 表示 Elasticsearch 错误响应的结构 type ErrorResponse struct { Error struct { RootCause []struct { Type string `json:"type"` Reason string `json:"reason"` } `json:"root_cause"` Type string `json:"type"` Reason string `json:"reason"` CausedBy struct { Type string `json:"type"` Reason string `json:"reason"` } `json:"caused_by,omitempty"` } `json:"error"` Status int `json:"status"` } type SearchResult struct { Took int `json:"took"` TimedOut bool `json:"timed_out"` Hits struct { Total struct { Value int `json:"value"` Relation string `json:"relation"` } `json:"total"` Hits []struct { Index string `json:"_index"` Type string `json:"_type"` ID string `json:"_id"` Score float64 `json:"_score"` Source json.RawMessage `json:"_source"` } `json:"hits"` } `json:"hits"` }