Handles `console.log` and `utils.inspect` invocations for a better debugging experience.
`agent` and `ssl` are hidden since they made the logs very hard to read.
The user can still access them with `instance.agent` and `instance.ssl`.
In very few cases, some API uses the same key for both url and query params, such as the bulk method.
The client is not designed to handle such cases since accepts both url and query keys in the same object, and the url parameter will always take precedence.
This pr fixes this edge case by adding a `querystring` key in the options object.
Fixes: https://github.com/elastic/elasticsearch-js/pull/778
```js
client.bulk({
index: 'index',
type: '_doc',
body: [...]
}, {
querystring: {
type: '_doc'
}
}, console.log)
```
* Updated dependencies
* Updated .gitignore
* WIP: macro and micro benchmarks
* Updated benchmark suite
* Use the same suite for both macro and micro benchmarks
* WIP: benchmark report
* Updated benchmark suite
* Updated docker scripts
* Updated benchmark suite
* Updated scripts
* Updated benchmark suite
* Added split2
- The result object contains also the metadata about the request
- The events emits the same object of the API response
- The errors, where possible, exposes the APi response object under the
meta key
With this pr we introduce the `client.child` API, which returns a new client instance that shares the connection pool with the parent client.
This feature can be handy if you need to have multiple client instances with different configurations, but with a shared connection pool.
Example:
```js
const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:9200' })
const child = client.child({
headers: { 'x-foo': 'bar' },
requestTimeout: 1000
})
client.info(console.log)
child.info(console.log)
```
**Open questions:**
* Currently, the event emitter is shared between the parent and the child(ren), is it ok?
* Currently, if you extend the parent client, the child client will have the same extensions, while if the child client adds an extension, the parent client will not be extended. Is it ok?
**Caveats:**
* You can override _any_ option except for the connection pool specific options (`ssl`, `agent`, `pingTimeout`, `Connection`, and `resurrectStrategy`).
* You can't specify a new `Connection` class.
* If you call `close` in any of the parent/child clients, every client will be closed.
_Note: the `nodeFilter` and `nodeSelector` options are now `Transport` options and no longer `ConnectionPool` options._