* Updated code generation
* Switched request and response generics position
* Updated test
* API generation
* Removed unused generics
* Test type definitions for callback style API as well
* Fix comments
* Fix conflict
* API generation
* Updated type def
* Updated abort behavior
- Support for aborting a request with the promise api
- Aborting a request will cause a RequestAbortedError
- Normalized Connection class errors, now every error returned is
wrapped by the client errors constructors
* Updated test
* Updated docs
* Updated code generation script
* Renamed test
* Code coverage
* Avoid calling twice transport.request
* Added client helpers
* Updated test
* The search helper should return only the documents
* Added code comments
* Fixed bug
* Updated test
* Removed bulkSize and added flushBytes
* Updated test
* Added concurrency
* Updated test
* Added support for 429 handling in the scroll search helper
* Updated test
* Updated stats count
* Updated test
* Fix test
* Use client maxRetries as default
* Updated type definitions
* Refactored bulk helper to be more consistent with the client api
* Updated test
* Improved error handling, added refreshOnCompletion option and forward additinal options to the bulk api
* Updated type definitions
* Updated test
* Fixed test on Node v8
* Updated test
* Added TODO
* Updated docs
* Added Node v8 note
* Updated scripts
* Removed useless files
* Added helpers to integration test
* Fix cli argument position
* Moar fixes
* Test run elasticsearch in github actions
* Use master action version
* Add vm.max_map_count step
* Test new action setup
* Added Configure sysctl limits step
* Updated action to latest version
* Don't run helpers integration test in jenkins
* Run helpers integratino test also with Node v10
* Updated docs
* Updated docs
* Updated helpers type definitions
* Added test for helpers type definitions
* Added license header
* Updated types generation script
* Refactored api method definitions
* Updated test
- Removed old test code
- Added tsd dev dependency
- Rewritten test with tsd
* Removed unused dependencies
* Fixed definition
* Updated test
* Updated docs
* Improved events type definitions
* Updated test
* Minor fixes in the type definitons
* More type test
* Improved Transport type definitions
* Updated test
* Addressed comments
* Code generation
* Use RequestBody, Response and Context everywhere, also default Context to unknown
* Updated test
* body -> hasBody
* Fixed conflicts
* Updated code generation
* Improved request body type definition
* Updated code generation
* Use BodyType for both request and reponses generics
- Use extends for defining the RequestBody generic to force the user
following the same shape.
- BodyType and NDBodyType now accepts a generics to allow injecting
more specific types in the future
* API generation
* Updated test
* Updated docs
* Use BodyType also in ReponseError
* Removed useless client generics
* Renamed generics and types
- prefixed all generics with a T
- BodyType => RequestBody
- NDBodyType => RequestNDBody
- Added ResponseBody
* Updated test
* Updated docs
* Test ResponseBody as well
* Simplify overloads
* API generation
* Updated test
* Updated error types
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._