I am using a lambda function to send data to kinesis-firehose then to elasticsearch. In my ElasticsearchDelivery log I am getting the following error:
{"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}}
I am struggling to find solutions for this one online. I suspect there is something wrong with how I am returning the data in my lambda function but not sure how to fix it.
This is my lambda function:
exports.handler = async (event) => {
var output = [];
var records = event.records;
records.map(function (record) {
output.push({
'recordId': record['recordId'],
'result': 'Ok',
'data':new Buffer(record.data).toString('base64')
})
});
console.log("OUTPUT!!!!:", output)
return {'records': output};
};