Helper library for [un]marshalling elastic-builder objects
$ npm install elastic-marshal
'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.
- elastic-builder - elasticsearch query builder
- serialijse - serialize and deserialize javascript objects
- elastic-muto - easy expressive search queries for elasticsearch
MIT © Suhas Karanth