Updated type definitions (#882)

* Updated type definitions

* Updated test
This commit is contained in:
Tomas Della Vedova
2019-06-19 09:14:19 +02:00
committed by GitHub
parent a1ca9cdda0
commit ca50f580f4
3 changed files with 39 additions and 7 deletions

View File

@ -27,13 +27,29 @@ import {
ResurrectEvent,
events,
errors,
ClientExtendsCallbackOptions
ClientExtendsCallbackOptions,
NodeOptions
} from '../../index'
import { TransportRequestParams, TransportRequestOptions } from '../../lib/Transport'
import { URL } from 'url'
const client = new Client({ node: 'http://localhost:9200' })
const nodeOpts: NodeOptions = {
url: new URL('http://localhost:9200'),
id: 'winteriscoming',
headers: { 'foo': 'bar' },
roles: {
master: false,
data: true,
ingest: false,
ml: false
}
}
const client2 = new Client({ node: nodeOpts })
client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => {
if (err) console.log(err)
const { body, statusCode } = request