Commit Graph

23 Commits

Author SHA1 Message Date
68c4dd29fb feat: add support for querystring in options object (#779)
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)
```
2019-03-19 09:53:43 +01:00
cae38e6b2b License (#773)
- Added license header
- Added license checker
- Fixed tap
2019-03-08 07:47:24 +01:00
5b856cd4c2 Child client support (#768)
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._
2019-02-21 12:48:49 +01:00
66e8d61476 Updated test 2019-02-20 12:43:15 +01:00
2dbf00e821 Updated test 2019-02-12 16:40:19 +01:00
d9a5f24e24 Code coverage++ 2019-02-11 17:37:44 +01:00
3023e45661 Updated test 2019-02-11 12:03:55 +01:00
23cfe11e44 Unknown parameters handling (#761) 2019-01-29 17:31:43 +01:00
4bf9128cac Updated test 2018-12-12 19:48:27 +01:00
a86a552a85 Updated test 2018-12-12 16:53:51 +01:00
bf4adf0546 Updated test 2018-12-03 18:11:59 +01:00
53329e48bc Updated test 2018-11-20 18:52:22 +01:00
da710e26e1 Updated test 2018-11-19 11:35:02 +01:00
bd5ba19e17 Updated test 2018-11-15 17:53:54 +01:00
ca5e9ca743 Force close the server once the test is finished 2018-11-09 18:09:29 +01:00
9df4fcbbb6 Updated test 2018-11-09 17:17:05 +01:00
869b50fca9 Updated test 2018-11-08 19:41:33 +01:00
40cb37b2e8 Updated test 2018-11-05 19:22:36 +01:00
21a5c29aa8 Updated test 2018-10-30 16:36:03 +01:00
961b8224ef Updated test 2018-10-26 19:06:04 +02:00
8429ad28d9 Updated test 2018-10-25 17:16:29 +02:00
aca2712161 Updated test 2018-10-24 15:52:17 +02:00
b6b04f99d8 WIP: Added some basic unit tests
- Added unit test
- Added test fixtures
- Added test utils
2018-10-22 16:54:14 +02:00