@financial-times/n-concept-bump

5.0.0 • Public • Published

Next Concept Bump

CircleCI

Interface for updating annotations for FT.com content.

It works by creating a task on the target Elasticsearch cluster which will find and rewrite annotations and concepts used by our content without the need to reingest.

Prerequisites

Compatible with Node 6+

Usage

CLI

You can view the available commands and options by running:

$ bump --help

You will also need to set some enviroment variables for authorisation:

  • THINGS_API_KEY for accessing data from the FT things API

And if you are working with a cluster provided by AWS:

  • ES_AWS_ACCESS_KEY an AWS access key with Elasticsearch administrative permissions
  • ES_AWS_SECRET_ACCESS_KEY an AWS secret access key for the above

The example below assumes the existence of a HOST environment variable specifying the URL of the Elasticsearch cluster:

# The script will find the latest version and all superseded IDs for the given concept
$ bump "${HOST}" 6d289d62-0272-39e0-9254-28ac84fd3279
> ? Replace 6d289d62-0272-39e0-9254-28ac84fd3279 with a16e302d-07c2-4a5c-89c8-d5e53691015e? (Y/n)
> Update successful: Updated 1291 items in 581ms

Node

The module exports a single function:

const bump = require('@financial-times/n-concept-bump');
const host = 'http://localhost:9200';

// The module will find the latest version and all superseded IDs for the given concept
bump(host, '70f4732b-7f7d-30a1-9c29-0cceec23760e');

As with CLI usage, you will need the API_KEY environment variable set and ES_AWS_ACCESS_KEY and ES_AWS_SECRET_ACCESS_KEY enviroment variables if working on an AWS provided cluster.

Limitations

  • This software can replace multiple targets but only with a single concept. This means multiple concept changes must be queued and processed in series.
  • When an Elasticsearch document is modified it is placed into a queue for processing. A document cannot be queued twice so if a document affected by this script is also reingested there will be a version mismatch and one version will be ignored.

/@financial-times/n-concept-bump/

    Package Sidebar

    Install

    npm i @financial-times/n-concept-bump

    Weekly Downloads

    12

    Version

    5.0.0

    License

    none

    Unpacked Size

    638 kB

    Total Files

    22

    Last publish

    Collaborators

    • robertboulton
    • seraph2000
    • hamza.samih
    • notlee
    • emmalewis
    • aendra
    • the-ft
    • rowanmanning
    • chee
    • alexwilson