bugfix
This commit is contained in:
parent
0aee33d553
commit
d30233204f
19
model/es.go
19
model/es.go
@ -7,7 +7,24 @@ type ESSource struct {
|
||||
Sort []any `json:"sort"`
|
||||
}
|
||||
|
||||
type ESResponse struct {
|
||||
type ESResponseV6 struct {
|
||||
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 int `json:"total"`
|
||||
MaxScore float64 `json:"max_score"`
|
||||
Hits []*ESSource `json:"hits"`
|
||||
} `json:"hits"`
|
||||
}
|
||||
|
||||
type ESResponseV7 struct {
|
||||
ScrollId string `json:"_scroll_id"`
|
||||
Took int `json:"took"`
|
||||
TimedOut bool `json:"timed_out"`
|
||||
|
@ -24,7 +24,7 @@ func ReadData(ctx context.Context, client *elastic.Client, index string, size, m
|
||||
var (
|
||||
err error
|
||||
resp *esapi.Response
|
||||
result = new(model.ESResponse)
|
||||
result = new(model.ESResponseV6)
|
||||
scrollId string
|
||||
total int
|
||||
)
|
||||
@ -121,7 +121,7 @@ func ReadData(ctx context.Context, client *elastic.Client, index string, size, m
|
||||
return
|
||||
}
|
||||
|
||||
result = new(model.ESResponse)
|
||||
result = new(model.ESResponseV6)
|
||||
|
||||
decoder = json.NewDecoder(resp.Body)
|
||||
if err = decoder.Decode(result); err != nil {
|
||||
|
@ -28,7 +28,7 @@ func ReadData(ctx context.Context, client *elastic.Client, index string, size, m
|
||||
var (
|
||||
err error
|
||||
resp *esapi.Response
|
||||
result = new(model.ESResponse)
|
||||
result = new(model.ESResponseV7)
|
||||
scrollId string
|
||||
total int
|
||||
)
|
||||
@ -125,7 +125,7 @@ func ReadData(ctx context.Context, client *elastic.Client, index string, size, m
|
||||
return
|
||||
}
|
||||
|
||||
result = new(model.ESResponse)
|
||||
result = new(model.ESResponseV7)
|
||||
|
||||
decoder = json.NewDecoder(resp.Body)
|
||||
if err = decoder.Decode(result); err != nil {
|
||||
@ -232,7 +232,7 @@ func ReadDataV2(
|
||||
return
|
||||
}
|
||||
|
||||
var result = new(model.ESResponse)
|
||||
var result = new(model.ESResponseV7)
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
if err = decoder.Decode(result); err != nil {
|
||||
errCh <- err
|
||||
|
Loading…
x
Reference in New Issue
Block a user