@ocap/indexdb-elasticsearch

1.18.123 • Public • Published

styled with prettier

OCAP indexdb adapter that stores data in elasticsearch

Install

npm install @ocap/indexdb-elasticsearch
// or
yarn add @ocap/indexdb-elasticsearch

Usage

const ESIndexDB = require('@ocap/indexdb-elasticsearch');

const indexdb = new ESIndexDB({
  tokenLength: 28,
  endpoint: process.env.ES_ENDPOINT,
  auth:
    process.env.ES_USERNAME && process.env.ES_PASSWORD
      ? {
          username: process.env.ES_USERNAME,
          password: process.env.ES_PASSWORD,
        }
      : null,
  prefix: 'dev',
  requestTimeout: 30000,
});

If you run this in production please set ES_SHARD_COUNT and ES_REPLICA_COUNT properly to achieve better reliability and performance

Run test

Create a file: indexdb/elasticsearch/.env.test, and input:

ES_ENDPOINT=<elasticsearch endpoint>
ES_USERNAME=<elasticsearch username>
ES_PASSWORD=<elasticsearch password>

/@ocap/indexdb-elasticsearch/

    Package Sidebar

    Install

    npm i @ocap/indexdb-elasticsearch

    Weekly Downloads

    104

    Version

    1.18.123

    License

    Apache-2.0

    Unpacked Size

    59 kB

    Total Files

    28

    Last publish

    Collaborators

    • wangshijun
    • polunzh
    • mave99a