2.1.2 • Published 6 years ago

e3po v2.1.2

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

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: {}
})
2.1.2

6 years ago

2.1.1

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.0.0

7 years ago