elastic-marshal
v1.0.1
Published
Helper library for [un]marshalling elastic-builder objects
Downloads
4
Readme
elastic-marshal
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
- elastic-builder - elasticsearch query builder
- serialijse - serialize and deserialize javascript objects
- elastic-muto - easy expressive search queries for elasticsearch
License
MIT © Suhas Karanth