0.2.5 • Published 8 years ago

rx-elasticsearch v0.2.5

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Rx-elasticsearch Build Status npm version

RxJS Observables for the Elasticsearch javascript client

Install with npm npm install rx-elasticsearch --save

Wrap existing Elasticsearch client

import RxClient from 'rx-elasticsearch';
import * as elasticsearch from 'elasticsearch';

let client = new elasticsearch.Client({
    host: 'localhost:9200',
    log: 'info'
});

let rxClient = new RxClient(client);

Initialization without Elasticsearch client

import RxClient from 'rx-elasticsearch';

let rxClient = RxClient.create({
    host: 'localhost:9200',
    log: 'info'
});

Usage is the same as the Elasticsearch client, but returns observables.

let params = {
    index: 'yourIndex',
    body: {
        query: {
            match_all: {}
        }
    }
};

rxClient
    .search(params)
    .subscribe(
        (res) => console.log(res),
        (e) => console.error(e),
        () => console.log('done')
    );

With the scroll function you no longer need to call search first. This library takes care of that and clears the scroll automagicly when the scroll is finished.

let params = {
    index: 'yourIndex',
    scroll: '1m',
    size: 1000,
    body: {
        query: {
            match_all: {}
        }
    }
};

rxClient
    .scroll(params)
    .subscribe(
        (res) => console.log(res),
        (e) => console.error(e),
        () => console.log('done')
    );

For older javascript versions

var RxClient = require('rx-elasticsearch').default;
0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

1.0.0

8 years ago