(t *testing.T, client *elasticsearch.TypedClient, index string, docs []T)
| 289 | } |
| 290 | |
| 291 | func ingestDocs[T any](t *testing.T, client *elasticsearch.TypedClient, index string, docs []T) (time.Duration, error) { |
| 292 | t.Helper() |
| 293 | start := time.Now() |
| 294 | bulk := client.Bulk() |
| 295 | for _, doc := range docs { |
| 296 | if err := bulk.IndexOp(types.IndexOperation{Index_: &index}, doc); err != nil { |
| 297 | t.Fatalf("Error adding bulk operation: %s", err) |
| 298 | } |
| 299 | } |
| 300 | _, err := bulk.Do(context.Background()) |
| 301 | elapsed := time.Since(start) |
| 302 | return elapsed, err |
| 303 | } |
no test coverage detected