GithubHelp home page GithubHelp logo

isabella232 / algolia-index-transform Goto Github PK

View Code? Open in Web Editor NEW

This project forked from algolia/algolia-index-transform

0.0 0.0 0.0 30 KB

Transform an index using map, reduce or filter and push to a brand new index.

JavaScript 100.00%

algolia-index-transform's Introduction

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

Paramater Type Description
sourceApplicationID String The Application ID where the current index resides
sourceApiKey String The API Key for the app where the current index resides
sourceIndexName String The index name of the current index
destinationApplicationID String The Application ID of where you would like to add the index
destinationApiKey String The API Key for the new index
destinationIndexName String The new index name
limit (Optional) Number Optional: Limit the amount of records to transfer
requestOptions (Optional) Object Optional: Object containing request options for browseAll
copySettings (Optional) Boolean Optional: 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);

algolia-index-transform's People

Contributors

therealwebby avatar dzello avatar pixelastic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.