MCPcopy
hub / github.com/elastic/go-elasticsearch / ingestDocs

Function ingestDocs

internal/testing/e2e/base64_bulk_integration_test.go:291–303  ·  view source on GitHub ↗
(t *testing.T, client *elasticsearch.TypedClient, index string, docs []T)

Source from the content-addressed store, hash-verified

289}
290
291func 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}

Callers 1

TestBase64BulkIndexingFunction · 0.70

Calls 3

DoMethod · 0.65
BulkMethod · 0.45
IndexOpMethod · 0.45

Tested by

no test coverage detected