Socket
Socket
Sign inDemoInstall

elasticsearch-model

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    elasticsearch-model

easy model builder for elasticsearch


Version published
Weekly downloads
5
Maintainers
1
Install size
19.7 kB
Created
Weekly downloads
 

Readme

Source

elasticsearch-model

easy model builder for elasticsearch

Getting Started

npm i elasticsearch-model 

Usage

const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'http://localhost:30100' })

const {
    t,
    ESModel,
} = require('elasticsearch-model')

class Model extends ESModel {

    custom () {
    }
}

// createdAt and updatedAt are both required

const mapping = t.Mapping({
    hello: t.KEYWORD,
    createdAt: t.DATE,
    updatedAt: t.DATE,
})

// Model

const name = 'doc'

const options = {
    client,
    index: name,
    type: name,
    mapping,
}

const model = new Model(options)

// model.updateMapping()

// Template
const name = 'log'

const options = {
    client,
    index: name,
    type: name,
    mapping,
}

const template = new Model(options)
const model = template.toModel('2019')

// template.updateTemplate()

Test

npm test

FAQs

Last updated on 17 May 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc