Hi,
I am trying to insert data from dynamodb to elasticsearch through lambda function. But it is creating new indices in elasticsearch whenever I insert data in dynamoDB. The versionField in "dynamo2es-lambda" plugin is throwing fieldNotFound error.
Below is my lambda function.
const d2es = require('dynamo2es-lambda');
exports.handler = d2es({
elasticsearch: {
hosts: 'https://search-inventory-elasticsearchendpointpath.us-west-2.es.amazonaws.com',
bulk: {
refresh: 'wait_for'
}
},
indexField: ['product_id'],
type: 'string',
idField: 'product_id',
versionField: '_version',
separator: '-',
beforeHook: (event, context) => context.log.info({ event }),
afterHook: (event, context, result) => {
context.log.info({ result });
if (result.errors) {
/* error handling logic */
}
},
errorHook: (event, context, err) => context.log.error({ err }),
recordErrorHook: (event, context, err) => context.log.error({ err })
});
Please help me