Skip to content

Commit

Permalink
feat(create_index): exit with warnings if header size settings are no…
Browse files Browse the repository at this point in the history
…t in effect

This avoids issues with Elasticsearch 5 headers and Node.js 8.14/10.14
as described in #339
  • Loading branch information
orangejulius committed Jan 15, 2019
1 parent 2b3bba5 commit e39b9e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"elasticsearch": "^15.0.0",
"joi": "^14.0.0",
"lodash.merge": "^4.6.0",
"pelias-config": "^3.5.0"
"pelias-config": "^3.5.0",
"pelias-logger": "^1.3.0"
},
"devDependencies": {
"difflet": "^1.0.1",
Expand Down
15 changes: 15 additions & 0 deletions scripts/create_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const child_process = require('child_process');
const http = require('http');

const config = require('pelias-config').generate();
const logger = require('pelias-logger').get('schema');
const es = require('elasticsearch');

const cli = require('./cli');
Expand All @@ -17,6 +18,20 @@ try {
process.exit(1);
}

if (http.maxHeaderSize === undefined) {
logger.warning('You are using a version of Node.js that does not support the --max-http-header-size option.' +
'You may experience issues when using Elasticsearch 5.' +
'See https://github.com/pelias/schema#compatibility for more details.');
}

if (http.maxHeaderSize < 16384) {
logger.error('Max header size is below 16384 bytes. ' +
'Be sure to use the provided wrapper script in \'./bin\' rather than calling this script directly.' +
'Otherwise, you may experience issues when using Elasticsearch 5.' +
'See https://github.com/pelias/schema#compatibility for more details.');
process.exit(1);
}

cli.header("create index");
const indexName = config.schema.indexName;

Expand Down

0 comments on commit e39b9e2

Please sign in to comment.