Drop support for body param in helpers and tests (#2521)

* Update tests and bulk helper to stop using body param

* Update compatible-with content-type header for 9.0
This commit is contained in:
Josh Mock
2024-12-05 13:03:19 -06:00
committed by GitHub
parent e9c2f8b0af
commit 6447fc10bf
4 changed files with 31 additions and 150 deletions

View File

@ -383,9 +383,9 @@ export default class Client extends API {
maxResponseSize: options.maxResponseSize,
maxCompressedResponseSize: options.maxCompressedResponseSize,
vendoredHeaders: {
jsonContentType: 'application/vnd.elasticsearch+json; compatible-with=8',
ndjsonContentType: 'application/vnd.elasticsearch+x-ndjson; compatible-with=8',
accept: 'application/vnd.elasticsearch+json; compatible-with=8,text/plain'
jsonContentType: 'application/vnd.elasticsearch+json; compatible-with=9',
ndjsonContentType: 'application/vnd.elasticsearch+x-ndjson; compatible-with=9',
accept: 'application/vnd.elasticsearch+json; compatible-with=9,text/plain'
},
redaction: options.redaction
})

View File

@ -910,7 +910,7 @@ export default class Helpers {
function tryBulk (bulkBody: string[], callback: (err: Error | null, bulkBody: string[]) => void): void {
if (shouldAbort) return callback(null, [])
client.bulk(Object.assign({}, bulkOptions, { body: bulkBody }), reqOptions as TransportRequestOptionsWithMeta)
client.bulk(Object.assign({}, bulkOptions, { operations: bulkBody }), reqOptions as TransportRequestOptionsWithMeta)
.then(response => {
const result = response.body
const results = zipBulkResults(result.items, bulkBody)