# @hossny94/mongoosastic

> A mongoose plugin that indexes models into elastic search. Based on mongoosastic v4.6.0 by James R. Carr. Added support for mongoose v6.X.X

Latest version **1.0.0** (published 2021-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hossny94/mongoosastic
pnpm add @hossny94/mongoosastic
yarn add @hossny94/mongoosastic
bun add @hossny94/mongoosastic
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-10-27 |
| First published | 2021-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8.0 |
| Dependencies | 2 |
| Unpacked size | 198.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mohamed Hossny |
| Maintainers | hossny94 |

## Links

- npm: https://www.npmjs.com/package/@hossny94/mongoosastic
- Repository: https://github.com/hossny94/mongoosastic
- Homepage: https://github.com/hossny94/mongoosastic#readme
- Issues: https://github.com/hossny94/mongoosastic/issues
- npm.io page: https://npm.io/package/@hossny94/mongoosastic

## Dependencies (2)

- [elasticsearch](https://npm.io/package/elasticsearch.md) 16.7.1
- [lodash.clonedeep](https://npm.io/package/lodash.clonedeep.md) 4.5.0

## Recent versions

- 1.0.0 (latest) — 2021-10-27

## README

# Mongoosastic
Mongoosastic is a [mongoose](http://mongoosejs.com/) plugin that can automatically index your models into [elasticsearch](https://www.elastic.co/).


## Getting started

1. Install the package

```bash
npm i @hossny94/mongoosastic
```

2. Setup your mongoose model to use the plugin

```javascript
var mongoose     = require('mongoose')
  , mongoosastic = require('@hossny94/mongoosastic')
  , Schema       = mongoose.Schema

var User = new Schema({
    name: String
  , email: String
  , city: String
})

User.plugin(mongoosastic)
```

3. Query your Elasticsearch with the `search()` method (added by the plugin)

```javascript
User.search({
  query_string: {
    query: "john"
  }
}, function(err, results) {
  // results here
});

```

---
_Source: https://npm.io/package/@hossny94/mongoosastic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
