Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Prod Release - v1.0.0 #15

Merged
merged 18 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixing ES access to AWS ES Search
  • Loading branch information
Vikas Agarwal committed Aug 5, 2021
commit d650e996489e3153f3e4d6a96210198d53c4e05e
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
ES: {
HOST: process.env.ES_HOST || 'http://localhost:9200',
ES_REFRESH: process.env.ES_REFRESH || 'true',
ES_API_VERSION: process.env.ES_API_VERSION || "7.4",

ELASTICCLOUD: {
id: process.env.ELASTICCLOUD_ID,
Expand Down
14 changes: 11 additions & 3 deletions src/common/es-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ function getESClient () {
}
})
} else {
esClient = new elasticsearch.Client({
node: host
})
if (/.*amazonaws.*/.test(host)) {
esClient = elasticsearch.Client({
apiVersion: config.get('ES.ES_API_VERSION'),
hosts: host,
connectionClass: require('http-aws-es'), // eslint-disable-line global-require
});
} else {
esClient = new elasticsearch.Client({
node: host
})
}
}
return esClient
}
Expand Down