https://github.com/smartive/proc-that-elastic-loader
Loader for proc-that. Loads processed items into an elasticsearch index.
https://github.com/smartive/proc-that-elastic-loader
elasticsearch node typescript
Last synced: 3 months ago
JSON representation
Loader for proc-that. Loads processed items into an elasticsearch index.
- Host: GitHub
- URL: https://github.com/smartive/proc-that-elastic-loader
- Owner: smartive
- License: mit
- Created: 2016-04-01T15:49:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-15T14:33:39.000Z (4 months ago)
- Last Synced: 2025-03-23T08:51:14.586Z (3 months ago)
- Topics: elasticsearch, node, typescript
- Language: TypeScript
- Homepage: http://smartive.github.io/proc-that-elastic-loader
- Size: 205 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ElasticLoader
Loader for `proc-that`. Loads processed items into an elasticsearch index.
##### A bunch of badges
[](https://travis-ci.org/smartive/proc-that-elastic-loader)
[](https://ci.appveyor.com/project/buehler/proc-that-elastic-loader)
[](https://www.npmjs.com/package/proc-that-elastic-loader)
[](https://coveralls.io/github/smartive/proc-that-elastic-loader)
[](https://github.com/smartive/proc-that-elastic-loader)
[](https://github.com/semantic-release/semantic-release)
[](https://greenkeeper.io/)## Installation
```bash
npm install --save proc-that-elastic-loader
```## Usage
```typescript
import {Etl} from 'proc-that';
import {ElasticLoader} from 'proc-that-elastic-loader';let loader = new ElasticLoader({/*es-config*/}, 'index', 'type');
new Etl().addLoader(loader).start().subscribe(/*...*/);
```### Custom id selector
If your object does not have the property "id" or you need to select
a different property for item identification, you can set the last constructor
parameter `idSelector` and use a custom function.```typescript
import {Etl} from 'proc-that';
import {ElasticLoader} from 'proc-that-elastic-loader';let loader = new ElasticLoader({/*es-config*/}, 'index', 'type', o => true, obj => obj.notDefaultId);
new Etl().addLoader(loader).start().subscribe(/*...*/);
```### Predicate
If you process multiple item types and your items are not stored
into the same index or the same index type, you can use the `predicate` param
to filter the items that are indexed by the loader. In the example below,
all items with `.type === 'Type1'` are only processed by `type1Loader`
and vice versa.```typescript
import {Etl} from 'proc-that';
import {ElasticLoader} from 'proc-that-elastic-loader';let type1Loader = new ElasticLoader({/*es-config*/}, 'index', 'type_1', obj => obj.type === 'Type1');
let type2Loader = new ElasticLoader({/*es-config*/}, 'index', 'type_2', obj => obj.type === 'Type2');new Etl().addLoader(type1Loader).addLoader(type2Loader).start().subscribe(/*...*/);
```