Files
elasticsearch-js/test/types/index.ts
Tomas Della Vedova ab1d7ba992 Typings support (#737)
* Updated scripts

* Updated .gitignore

* Removed symbols

* Fixed typo

* Added typings

* Updated test

* Added typings test
2018-11-30 17:01:55 +01:00

30 lines
593 B
TypeScript

'use strict'
import { Client, ApiResponse } from '../../index'
const client = new Client({ node: 'http://localhost:9200' })
// Callbacks
client.info((err: Error | null, result: ApiResponse) => {})
client.index({
index: 'test',
type: 'test',
id: 'test',
body: { hello: 'world' }
}, (err: Error | null, result: ApiResponse) => {})
// Promises
client.info()
.then((result: ApiResponse) => {})
.catch((err: Error) => {})
client.index({
index: 'test',
type: 'test',
id: 'test',
body: { hello: 'world' }
})
.then((result: ApiResponse) => {})
.catch((err: Error) => {})