我已更改代码,以便在将数据插入弹性搜索时使用Olivere包。这是代码
// Get a snapshot of stats (always blank if not enabled--see above)
stats := p.Stats()
fmt.Printf("Number of times flush has been invoked: %d\n", stats.Flushed)
fmt.Printf("Number of times workers committed reqs: %d\n", stats.Committed)
fmt.Printf("Number of requests indexed : %d\n", stats.Indexed)
fmt.Printf("Number of requests reported as created: %d\n", stats.Created)
fmt.Printf("Number of requests reported as updated: %d\n", stats.Updated)
fmt.Printf("Number of requests reported as success: %d\n", stats.Succeeded)
fmt.Printf("Number of requests reported as failed : %d\n", stats.Failed)
这是我得到的日志
Number of times flush has been invoked: 1
Number of times workers committed reqs: 0
Number of requests indexed : 0
Number of requests reported as created: 0
Number of requests reported as updated: 0
Number of requests reported as success: 0
Number of requests reported as failed : 0
我不知道为什么结果为0。我不确定如何找到错误所在。有人知道如何找到错误吗?