Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enrise-estools

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enrise-estools

Elasticsearch tooling functions for managing indices and aliases.

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Enrise estools

coverage report

Elasticsearch tooling functions for managing indices and aliases. This can be used within an elasticsearch environment where a seperate index needs to be managed next to the live index. The script works by creating two aliases: a feeder-alias and a search-alias. Both are managed seperately. The former is used to fill an index and is set using the upgrade function. And the search-alias is set using the switch function.

This package is highly opiniated. Therefore it is use at your own risk.

Usage

npm install enrise-estools

const estools = require('enrise-estools');

API Documentation

upgrade | Upgrade a feeder- alias

Creates a new versioned index according to the mapping, and points the feeder- alias to it.

estools.upgrade(esClient, index, options);

@param1: elasticsearch client
@param2: string | index to upgrade
@param2: options-object:
  - index: string | index to use
  - currentVersion: integer | existing version number, by default uses the $prefix $index version
  - targetVersion: integer | new version number, by default uses the highest $index version + 1
  - prefix: string, default:'feeder-' | prefix for feeder index
  - mapping: object, default:current feeder-mapping | mapping to use for the new index
  - synonyms: object={synonyms: [], preSynonyms: []} | synonyms to use for the new index, will overwrite the filters synonyms and pre_synonyms in the mapping with inline synonyms
  - useExistingSynonyms: boolean | uses the existing feeder-synonyms for the new index

helpers.getAliasVersion -> int | Retrieve the version of an alias

estools.helpers.getAliasVersion(esClient, alias);

@param1: elasticsearch client
@param2: string | alias

helpers.getIndexVersions -> [int] | Retrieve all versions (descending) of an index

estools.helpers.getIndexVersions(esClient, index);

@param1: elasticsearch client
@param2: string | index

Publishing a new version

Ensure your working directory is clean. The following commands create a new version number by updating the package.json file and adding a git tag. Then push the new version with the tag to git, where GitLab CI will publish a new version. Version should only be updated by npm version, do not manually update the version in package.json.

npm version <newversion>
git push --follow-tags

Todo

  • Switch function - to move the feeder- alias to the regular alias.
  • Reindex function - for reindexing between two different indices or aliases.
  • CLI tooling. When installing, this should be placed inside ./node_modules/.bin.
  • Improve description

FAQs

Package last updated on 20 Jan 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc