Skip to content

es.helpers.bulk sometimes ingest duplicate documents #2924

@pheyos

Description

@pheyos

🐛 Bug report

In Kibana testing, we're using es.helpers.bulk to ingest test data and sometimes, this is ingesting duplicate documents.

Investigation and reproduction was done in this Kibana PR, which also includes the reproduction code: elastic/kibana#228556

A few important details:

  • It happens on a low rate and requires many hundred runs to reproduce
  • It only reproduced in CI so far - probably because buildkite workers are slower than local developer machines
  • It only reproduced so far with ES SSL enabled
  • With maxRetries: 0 on the transport level, the flakiness didn't reproduce
  • Running the same setup with es.bulk instead of es.helpers.bulk didn't show the flakiness so far

To reproduce

With ES SSL enabled, repeat the following steps:

  • create index
  • ingest a single document via es.helpers.bulk
  • refresh index (either as part of bulk or separately
  • check number of documents in the index
  • delete index

In some cases after the bulk operation, the index contains 2 documents which are identical except the id.

Expected behavior

The number of documents in that index is always 1.

Node.js version

22.17.1

@elastic/elasticsearch version

9.0.3

Operating system

Buildkite worker / Linux

Any other relevant environment information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions