opensearch-sequelize
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

opensearch-sequelize

Sequelize-like promise-based Node.js ORM tool for OpenSearch.

Installation

The package is connected via npm.

npm i opensearch-sequelize

Using

Create model:

import { Table, Model } from "opensearch-sequelize";

@Table({ tableName: "movies" })
export class Movies extends Model {
  name!: string;
  year!: number;
  nextPart?: string;
}

Connect:

const sequelize = new Sequelize({
  host: "https://localhost:9200",
  username: "admin",
  password: "admin",
});

Using model:

const movies = await Movies.findAll({
  limit: 2,
  offset: 0,
  where: {
    name: { type: "fuzzy", value: "Matrix" },
    year: 1999,
  },
});

If methods doesn't provide necessary functionality, then use raw requests:

// GET /movies/_search with query
const data = await Movies.queryGet("_search", query);

Examples

You can find examples of using methods here.

Package Sidebar

Install

npm i opensearch-sequelize

Weekly Downloads

4

Version

1.1.7

License

ISC

Unpacked Size

53.2 kB

Total Files

29

Last publish

Collaborators

  • faetterp