feat: add es search res model
This commit is contained in:
parent
5c9d91ff63
commit
3c0b7479a0
27
internal/model/es.go
Normal file
27
internal/model/es.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type ESSource[T any] struct {
|
||||||
|
DocId string `json:"_id"`
|
||||||
|
Index string `json:"_index"`
|
||||||
|
Content T `json:"_source"`
|
||||||
|
Sort []any `json:"sort"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ESSearchResponse[T any] struct {
|
||||||
|
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"`
|
||||||
|
MaxScore float64 `json:"max_score"`
|
||||||
|
Hits []*ESSource[T] `json:"hits"`
|
||||||
|
} `json:"hits"`
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user