Socket
Socket
Sign inDemoInstall

elastic-ts

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    elastic-ts

TypeScript + Elasticsearch (types, query builder, magic)


Version published
Weekly downloads
2K
decreased by-26.74%
Maintainers
1
Install size
207 kB
Created
Weekly downloads
 

Readme

Source

✨ elastic-ts

Build Status Status: Alpha npm npm Powered by TypeScript

A TypeScript module for working with Elasticsearch.

Goals

  • Provide TypeScript types for Elasticsearch queries
  • Provide a typed query body builder with an immutable API

Non-goals

  • Replace the official Elasticsearch API client

Requirements

  • TypeScript 2.8 - this project uses conditional types which were introduced in TypeScript 2.8

Installation

yarn add elastic-ts

Usage

Types

import {SearchBody} from 'elastic-ts'

const body: SearchBody = {
  query: {
    match_all: {},
  },
}

Builder

import {esBuilder} from 'elastic-ts'

const body = esBuilder()
  .query('match_all', {})
  .filter('terms', 'field', ['one', 'two'])
  .build()

Credits

The query builder API is heavily inspired by bodybuilder, although there are subtle API and behavioral differences.

Contributing

You can build the project by running yarn build, or can be continuously built with yarn watch. Tests are executed by running yarn test.

NOTE: the tests run against the built output files, so you will need to run yarn build or yarn watch before running yarn test.

License

The MIT license. See LICENSE.

Keywords

FAQs

Last updated on 23 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc