elastic-marshal

1.0.1 • Public • Published

elastic-marshal Build Status

Helper library for [un]marshalling elastic-builder objects

Install

$ npm install elastic-marshal

Usage

'use strict';
 
const util = require('util');
const bob = require('elastic-builder');
const marshaller = require('elastic-marshal');
 
const qry = bob.boolQuery()
    .must(bob.termQuery('user', 'kimchy'))
    .must(bob.rangeQuery('age').gte(10).lte(20))
    .must(
        bob.boolQuery().should([
            bob.termQuery('tag', 'wow'),
            bob.termQuery('tag', 'elasticsearch')
        ])
    );
 
const qryStr = marshaller.marshal(qry);
 
console.log('Marshalled string -', qryStr);
 
const unmarshalled = marshaller.unmarshal(qryStr);
 
console.log('Unmarshalled object -', util.inspect(unmarshalled, true, 7, true));

The module uses elastic-builder and serialijse for serialisation and deserialisation of elastic-builder query objects.

Related

License

MIT © Suhas Karanth

Readme

Keywords

none

Package Sidebar

Install

npm i elastic-marshal

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • sudo-suhas