mirror of
https://github.com/minio/minio.git
synced 2025-01-12 15:33:22 -05:00
Fix Elastic crash with no index (#13406)
Removed naked assert. Fixes #13389
This commit is contained in:
parent
05fa790584
commit
9f652708ee
@ -419,7 +419,8 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error {
|
|||||||
return fmt.Errorf("Error parsing response body: %v", err)
|
return fmt.Errorf("Error parsing response body: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
indices := v["indices"].([]interface{})
|
indices, ok := v["indices"].([]interface{})
|
||||||
|
if ok {
|
||||||
for _, index := range indices {
|
for _, index := range indices {
|
||||||
name := index.(map[string]interface{})["name"]
|
name := index.(map[string]interface{})["name"]
|
||||||
if name == args.Index {
|
if name == args.Index {
|
||||||
@ -427,6 +428,7 @@ func (c *esClientV7) createIndex(args ElasticsearchArgs) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
resp, err := c.Indices.Create(args.Index)
|
resp, err := c.Indices.Create(args.Index)
|
||||||
|
Loading…
Reference in New Issue
Block a user