# elastic-marshal

> Helper library for [un]marshalling elastic-builder objects

Latest version **1.0.1** (published 2017-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install elastic-marshal
pnpm add elastic-marshal
yarn add elastic-marshal
bun add elastic-marshal
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-10-08 |
| First published | 2017-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Suhas Karanth |
| Maintainers | sudo-suhas |

## Links

- npm: https://www.npmjs.com/package/elastic-marshal
- Repository: https://github.com/sudo-suhas/elastic-marshal
- Homepage: https://github.com/sudo-suhas/elastic-marshal#readme
- Issues: https://github.com/sudo-suhas/elastic-marshal/issues
- npm.io page: https://npm.io/package/elastic-marshal

## Dependencies (2)

- [serialijse](https://npm.io/package/serialijse.md) ^0.1.3
- [elastic-builder](https://npm.io/package/elastic-builder.md) ^1.1.2

## Recent versions

- 1.0.1 (latest) — 2017-10-08
- 1.0.0 — 2017-09-29

## README

# elastic-marshal [![Build Status](https://travis-ci.org/sudo-suhas/elastic-marshal.svg?branch=master)](https://travis-ci.org/sudo-suhas/elastic-marshal)

> Helper library for [un]marshalling elastic-builder objects

## Install

```
$ npm install elastic-marshal
```

## Usage

```js
'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](https://github.com/sudo-suhas/elastic-builder) and [serialijse](https://github.com/erossignon/serialijse) for serialisation and deserialisation of `elastic-builder` query objects.

## Related

- [elastic-builder](https://github.com/sudo-suhas/elastic-builder) - elasticsearch query builder
- [serialijse](https://github.com/erossignon/serialijse) - serialize and deserialize javascript objects
- [elastic-muto](https://github.com/booleanapp/elastic-muto) - easy expressive search queries for elasticsearch

## License

MIT © [Suhas Karanth](https://github.com/sudo-suhas)

---
_Source: https://npm.io/package/elastic-marshal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
