This package has been deprecated

Author message:

no longer maintained

@betterthings/es-document

0.0.2 • Public • Published

ESDocument

A small implementation of an Elasticsearch document base class.

API

  • static get(id: string): Promise<Document | null>

  • static mget(ids: string[]): Promise<Array<Document | null>>

  • static search(body: object): Promise<{ total: number, data: Document[] }>: works great with bodybuilder.

  • static create(): Document: creating a document. Never call the constructor directly! You can implement static afterCreate(obj: Document) instead.

The return value of these static methods are typed to be the instance type of the class the method is called on. In test.ts, the TypeScript compiler correctly infers the type to be User, so you can benefit from editor tooling in VS Code and other editors.

The instances of Document have the following base functionality:

  • isNew(): boolean

  • getDocId(): string

  • store(): Promise<void>

Readme

Keywords

none

Package Sidebar

Install

npm i @betterthings/es-document

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

1.22 kB

Total Files

2

Last publish

Collaborators

  • laooola
  • lusbuab