question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v8.2.0 has broken the Bulk API

See original GitHub issue

🐛 Bug Report

v8.2.0 has broken the Bulk API function.

To Reproduce

Using https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/bulk_examples.html

With package.json:

{
  "dependencies": {
    "@elastic/elasticsearch": "8.2.0",
    "array.prototype.flatmap": "^1.2.5",
    "get-json": "^1.0.1"    
  }
}

run npm init

execute the JavaScript in the documentation

response is:

ResponseError: illegal_argument_exception: [illegal_argument_exception] Reason: The bulk request must be terminated by a newline [\n]
    at SniffingTransport.request (/home/luke/Projects/nfl-elastic-aggregations/es-import/node_modules/@elastic/transport/lib/Transport.js:476:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Client.BulkApi [as bulk] (/home/luke/Projects/nfl-elastic-aggregations/es-import/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js:51:12)
    at async run (/home/luke/Projects/nfl-elastic-aggregations/es-import/javascripts/bulk_example.js:58:24) {
  meta: {
    body: { error: [Object], status: 400 },
    statusCode: 400,
    headers: {
      'x-elastic-product': 'Elasticsearch',
      'content-type': 'application/json;charset=utf-8',
      'content-length': '245'
    },
    meta: {
      context: null,
      request: [Object],
      name: 'elasticsearch-js',
      connection: [Object],
      attempts: 0,
      aborted: false
    },
    warnings: [Getter]
  }

Deleting the node_modules folder, pinning “@elastic/elasticsearch” to 8.1.0, running node install and running the JavaScript again results in a successful call with the response being:

{
  count: 5,
  _shards: { total: 1, successful: 1, skipped: 0, failed: 0 }
}

To double check the node_modules folder was deleted and 8.2.0 was used again resulting in the same error as before.

Your Environment

  • node version: v16.15.0
  • @elastic/elasticsearch version: 8.2.0
  • os: Ubuntu 20.04 host with Elasticsearch docker image being used

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
delvedorcommented, May 9, 2022

Hello! We can’t release an “official” patch release yet, as the client must follow the Stack release versioning. However, we have released a custom patch version just for v8.2.0 to unblock you as quickly as possible. You should expect to see a definitive v8.2.1 in a few days. https://www.npmjs.com/package/@elastic/elasticsearch/v/8.2.0-patch.1

You can install it by running npm i @elastic/elasticsearch, make sure that the version installed is 8.2.0-patch.1.

1reaction
Jeffrey-Zuttcommented, May 9, 2022

We experience the same issue. Rolling back to 8.1.0 resolves it for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors | Bulk API 2.0 and Bulk API Developer Guide
The operation failed with an unknown client-side error. For binary attachments, the request content is provided both as an input stream and an...
Read more >
Bulk API 2.0 works in sandbox but broken in production
I'm trying to bulk import Task records using the Bulk API 2.0, which works perfectly fine in the sandbox, but fails with this...
Read more >
UDML Best Practices - DocuSign Support
Read about UDML best practices, including definitions of common model elements. UDML supports both word-level and sentence-level provisions/ ...
Read more >
Elasticsearch output plugin | Logstash Reference [8.5] | Elastic
This plugin attempts to send batches of events to the Elasticsearch Bulk API as a single request. However, if a batch exceeds 20MB...
Read more >
v8.x Release Notes - Sisense Documentation
Sisense recommends you reduce the number of categories to break on to ... Sisense for Windows V8.2.0/Linux V8.0.4 were upgraded to use Google...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found