Socket
Socket
Sign inDemoInstall

algolia-index-transform

Package Overview
Dependencies
28
Maintainers
15
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    algolia-index-transform

A selection of methods to transform an exisiting index using map, reduce or filter and push to a brand new index.


Version published
Weekly downloads
65
increased by8.33%
Maintainers
15
Created
Weekly downloads
 

Readme

Source

Algolia Index Transform

A selection of methods to transform an index using map, reduce or filter. and push to a brand new index.

Install

Node Using NPM

npm install algolia-index-transform

Node Using yarn

yarn add algolia-index-transform

Set Up

Once installed, you will need to initalize the Algolia Index Transform as below. Each property is required.

const AlgoliaIndexTransform = require('algolia-index-transform');

const algoliaIndexTransform = new AlgoliaIndexTransform({
  sourceApplicationID: 'xxxxxxxxxx',
  sourceApiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  sourceIndexName: 'an existing index',
  destinationApplicationID: 'xxxxxxxxxx',
  destinationApiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  destinationIndexName: 'a new index',
  limit: 20000,
  requestOptions: {
    attributesToRetrieve: ['*']
  },
  copySettings: false
});

Setting properties

ParamaterTypeDescription
sourceApplicationIDStringThe Application ID where the current index resides
sourceApiKeyStringThe API Key for the app where the current index resides
sourceIndexNameStringThe index name of the current index
destinationApplicationIDStringThe Application ID of where you would like to add the index
destinationApiKeyStringThe API Key for the new index
destinationIndexNameStringThe new index name
limit (Optional)NumberOptional: Limit the amount of records to transfer
requestOptions (Optional)ObjectOptional: Object containing request options for browseAll
copySettings (Optional)BooleanOptional: Copy destination settings with the transformation

Usage

Copy
algoliaIndexTransform.copy();
Map
algoliaIndexTransform.map(item => ({
  id: item.id
}));
Filter
algoliaIndexTransform.filter(item => item.popular === true);
Reduce
algoliaIndexTransform.reduce((acc, cur) => acc + cur);

FAQs

Last updated on 17 Jan 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc