Enable compression for both request and response when using Elastic Cloud
This commit is contained in:
6
index.js
6
index.js
@ -25,6 +25,12 @@ class Client extends EventEmitter {
|
|||||||
// the second the elasticsearch instance, the third the kibana instance
|
// the second the elasticsearch instance, the third the kibana instance
|
||||||
const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$')
|
const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$')
|
||||||
opts.node = `https://${username}:${password}@${cloudUrls[1]}.${cloudUrls[0]}`
|
opts.node = `https://${username}:${password}@${cloudUrls[1]}.${cloudUrls[0]}`
|
||||||
|
|
||||||
|
// Cloud has better performances with compression enabled
|
||||||
|
// see https://github.com/elastic/elasticsearch-py/pull/704.
|
||||||
|
// So unless the user specifies otherwise, we enable compression.
|
||||||
|
if (opts.compression == null) opts.compression = 'gzip'
|
||||||
|
if (opts.suggestCompression == null) opts.suggestCompression = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.node && !opts.nodes) {
|
if (!opts.node && !opts.nodes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user