You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

elasticsearch-extend

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticsearch-extend

extended elasticsearch with ODM functions

0.1.2
latest
npm
Version published
Weekly downloads
5
-16.67%
Maintainers
1
Weekly downloads
 
Created
Source

elasticsearch-extend

npm version

Extended official elasticsearch module with ODM functions

Features

  • Compatible with official elasticsearch
  • ES6 syntax(generator, class, etc).

How to use

Init es connection:

const es = require('elasticsearch-extend');

es.connect({
    host: 'localhost:9200',
    log: 'info'
})
.then(function(){ ... })
.catch(function(error){ ... });

Once connected, register a model:

const UserModel = es.model('user', {
    username: { type: "string"},
    phone: { type: "string"}
});

Get a registered model:

const UserModel = es.model('user');

APIs

es.connect(params)

Connect to an elasticsearch server

es.isConnected

Indicate whether elasticsearch connected or not

es.model(modelName, mapping)

Register a model

es.model(modelName)

Get a model

Model APIs

model.createOne(params)

Create one document

model.list(params)

List documents

ToDos

  • More model APIs
  • Document APIs

Keywords

elasticsearch

FAQs

Package last updated on 28 Jun 2016

Did you know?

Socket

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.

Install

Related posts