be careful when reading elastic response
This commit is contained in:
parent
b8c30e87d7
commit
8c76455b60
|
@ -46,11 +46,15 @@ func getPathsFromIndex() (map[string]string, map[string]string, error) {
|
|||
}
|
||||
|
||||
for {
|
||||
scrollID := r["_scroll_id"].(string)
|
||||
hits := r["hits"].(map[string]interface{})["hits"].([]interface{})
|
||||
scrollID, ok := r["_scroll_id"].(string)
|
||||
if !ok {
|
||||
// No more pages to scroll through
|
||||
break
|
||||
}
|
||||
|
||||
// Break after no more documents
|
||||
hits := r["hits"].(map[string]interface{})["hits"].([]interface{})
|
||||
if len(hits) == 0 {
|
||||
// Break after no more documents
|
||||
break
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue