Hi,
I am trying to BULK POST to elasticsearch in K6 but I am getting an error that : “The bulk request must be terminated by a newline [\n]”.
Any tips on how I can fix this?
Here is:
const params = {
headers: {
'Content-Type': 'application/x-ndjson',
Authorization : `Basic ${encodedCredentials}`
},
};
const data1 = {
"amount" : "100",
"@timestamp" : `${UTC_timestamp}`,
"transaction_attributes" : {
"channel" : "channel-foobarbaz",
"session_id" : "session-1234",
"information" : "iinformation-foobarbaznformation-foobarbaz"
},
"currency" : {
"currency_description" : "my currency description",
},
"external_timestamp" : "2021-12-03T11:22:55.206229500Z"
};
// execute a post
let res = http.post(url,JSON.stringify(data1),params);
check(res, {
"Create user response status code is 201": (r) => r.status == 201,
}
);