arithmetric / lambda-stash

AWS Lambda script to ship data from S3 to other data stores, like Elasticsearch
MIT License
52 stars 18 forks source link

AWS Elasticsearch does not accept application/x-ldjson #20

Open garrickstapleszed opened 6 years ago

garrickstapleszed commented 6 years ago

When talking to AWS Elasticsearch: Error occurred while preparing to ship data: { [Error: Content-Type header [application/x-ldjson] is not supported]. This is with elasticsearch.js 11.0.1.

application/json works fine. It's just a question of how to get lambda-stash to do it. I tried changing shipElasticsearch.js to set the headers, but it didn't work:

var esConfig = {
    host: config.elasticsearch.host,
    requestTimeout: config.elasticsearch.requestTimeout,
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json'
    }
  };

For now, I've modified the bottom of node_modules/elasticsearch/src/lib/serializers/json.js to use application/json.