46 lines
1.2 KiB
Go
Raw Normal View History

package model
2024-03-22 18:05:47 +08:00
2025-02-05 18:07:53 +08:00
type ESSource[T any] struct {
DocId string `json:"_id"`
Index string `json:"_index"`
Content T `json:"_source"`
Sort []any `json:"sort"`
2024-03-22 18:05:47 +08:00
}
2025-02-05 18:07:53 +08:00
type ESResponseV6[T any] struct {
2024-07-21 13:27:08 +08:00
ScrollId string `json:"_scroll_id"`
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits struct {
2025-02-05 18:07:53 +08:00
Total int `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []*ESSource[T] `json:"hits"`
2024-07-21 13:27:08 +08:00
} `json:"hits"`
}
2025-02-05 18:07:53 +08:00
type ESResponseV7[T any] struct {
2024-03-22 18:05:47 +08:00
ScrollId string `json:"_scroll_id"`
Took int `json:"took"`
TimedOut bool `json:"timed_out"`
Shards struct {
Total int `json:"total"`
Successful int `json:"successful"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
} `json:"_shards"`
Hits struct {
Total struct {
Value int `json:"value"`
Relation string `json:"relation"`
} `json:"total"`
2025-02-05 18:07:53 +08:00
MaxScore float64 `json:"max_score"`
Hits []*ESSource[T] `json:"hits"`
2024-03-22 18:05:47 +08:00
} `json:"hits"`
}