A TypeScript module for working with Elasticsearch.
- Provide TypeScript types for Elasticsearch queries
- Provide a typed query body builder with an immutable API
- Replace the official Elasticsearch API client
- TypeScript 2.8 - this project uses conditional types which were introduced in TypeScript 2.8
yarn add elastic-ts
import {SearchBody} from 'elastic-ts'
const body: SearchBody = {
query: {
match_all: {},
},
}
import {esBuilder} from 'elastic-ts'
const body = esBuilder()
.query('match_all', {})
.filter('terms', 'field', ['one', 'two'])
.build()
The query builder API is heavily inspired by bodybuilder, although there are subtle API and behavioral differences.
The MIT license. See LICENSE
.