1.1.7 • Published 12 months ago
opensearch-sequelize v1.1.7
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.