es-search-builder
v1.3.1
Published
Query builder for Elasticsearch
Downloads
16
Maintainers
Readme
es-search-builder
Query builder for Elasticsearch
Install
$ npm install --save es-search-builder
Usage
SearchBuilder
const SearchBuilder = require('es-search-builder').SearchBuilder;
const searchBuilder = new SearchBuilder();
const query = searchBuilder.createQuery();
const boolQuery = query.createBoolQuery()
.addFilter()
.setTerm({ status: 'Active' });
const result = searchBuilder.build();
MultiSearchBuilder
const MultiSearchBuilder = require('es-search-builder').MultiSearchBuilder;
const multiSearchBuilder = new MultiSearchBuilder();
const search = multiSearchBuilder.createSearch({ index: 'some-index' });
const query = search.createQuery();
const boolQuery = query.createBoolQuery()
.addFilter()
.setTerm({ status: 'Active' });
const result = multiSearchBuilder.build();
License
MIT