@ocap/indexdb-elasticsearch

OCAP indexdb adapter that uses elasticsearch as backend

Usage no npm install needed!

<script type="module">
  import ocapIndexdbElasticsearch from 'https://cdn.skypack.dev/@ocap/indexdb-elasticsearch';
</script>

README

@ocap/indexdb-elasticsearch

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,
});

Run test

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

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