This package has been deprecated

Author message:

Deprecated, not maintained

e3po
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

e3po

Module to index and search MongoDB documents using Elasticsearch

require("e3po")

Motivation: I'd prefer MongoDB syntax to query and update Elasticsearch index

Query operators

Query operators use Elasticsearch bool query

Update operators

Conditions operators available:

Update operators use Elasticsearch painless script

Modifiers are supported

$, $[] and $[<identifier>] operators are supported only with $set operator and without query selectors

Examples

e3po

const { Client } = require('elasticsearch')
const e3po = require('e3po')({
  client: new Client({ host: '127.0.0.1:9200' }),
  index: 'test',
  type: 'test'
})

e3po.search - search using Elasticsearch query

e3po.search({
  query: {},
  sort: { _id: -1 },
  skip: 0,
  limit: 1,
  projection: {}
})

e3po.find - search using MongoDB query

e3po.find({
  query: {},
  filter: {},
  sort: { _id: -1 },
  skip: 0,
  limit: 1,
  projection: {}
})

e3po.insert - create index

e3po.insert({
  body: { a: 1 }
})

e3po.upsert - create or update index

e3po.upsert({
  id: '1',
  body: { a: 1 }
})

e3po.update - update index

e3po.update({
  id: '1',
  body: { a: 2 }
)

e3po.remove - delete index

e3po.remove({
  id: '1'
})

e3po.updateByScript - update index using Elasticsearch painless script and MongoDB update operators

e3po.updateByScript({
  id: '1',
  body: {
    $set: {
      a: 2
    }
  }
})

e3po.updateByQuery - update index by query using Elasticsearch painless script, MongoDB query operators and MongoDB update operators

e3po.updateByQuery({
  query: {},
  body: {
    $set: {
      a: 2
    }
  }
)

e3po.removeByQuery - delete index by query using MongoDB query operators

e3po.removeByQuery({
  query: {}
})

Readme

Keywords

Package Sidebar

Install

npm i e3po

Weekly Downloads

14

Version

2.1.2

License

ISC

Unpacked Size

175 kB

Total Files

24

Last publish

Collaborators

  • dab00