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