Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
elastictype
Advanced tools
Elastictype is a easy way to model application data stored in Elasticsearch. It is inpsired by mongoose and @nestjs/mongoose and thus includes type casting, validation, query building, hooks and much more. It is written in TypeScript and thus provides typ
A Object Document Mapping (ODM) manager for Elasticsearch written in TypeScript.
Elastictype is a easy way to model application data stored in Elasticsearch. It is inpsired by mongoose and @nestjs/mongoose and thus includes type casting, validation, query building, hooks and much more. It is written in TypeScript and thus provides type safety.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Please make sure you have installed the following tools:
Install the package via npm:
npm install @cytex/elastictype --save
or via yarn:
yarn add @cytex/elastictype
import {
BaseSchema,
ElasticField,
ElasticDataType,
Index,
Model,
} from "@cytex/elastictype";
@Index({
name: "cats", // Name of the index
})
export class Cat extends BaseSchema<Cat> {
@Prop(ElasticDataType.Keyword)
public name: string;
@ElasticField({
// Type of the field (used for explicit mapping declaration)
type: ElasticDataType.Integer,
})
public age: number;
}
// Create the index and the mapping in Elasticsearch
Cat.syncMapping();
// Create a new cat
const cat = new Cat();
cat.name = "Garfield";
cat.age = 42;
// Save the cat to Elasticsearch
await cat.save();
// Update the cat
await cat.update({ age: 43 });
// Delete the cat
await cat.delete();
// Find all cats
const cats = await Cat.find({ age: 43 });
// Find a cat by id
const cat = await Cat.findById("foo");
Tests are written with jest. You can run them with the following command:
npm run test
FAQs
Elastictype is a easy way to model application data stored in Elasticsearch. It is inpsired by mongoose and @nestjs/mongoose and thus includes type casting, validation, query building, hooks and much more. It is written in TypeScript and thus provides typ
The npm package elastictype receives a total of 1 weekly downloads. As such, elastictype popularity was classified as not popular.
We found that elastictype demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.