Socket
Socket
Sign inDemoInstall

equery

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    equery

Query builder for Elasticsearch


Version published
Weekly downloads
2
Maintainers
1
Install size
844 kB
Created
Weekly downloads
 

Readme

Source

equery

npm version Build Status

Query builder for elasticsearch (Node.js / Javascript)

Installation

$ npm install equery

Usage

Building a query

var Query = require('equery');

var query = new Query();

query.toJSON

var result = q.toJSON();

query.sort

query
    .sort('followers:desc')
    .toJSON();

query.term

query
    .term('field', 'value')
    .toJSON();

PAgination

query.limit(100);
query.skip(10);

Chain

Queries are chainable:

query
    .term('user', 'Kimchy')
    .sort('followers:desc')
    .limit(100)
    .skip(10)
    .toJSON();

Filters

A filter can be set on the query using query.filter(filer). Multiple calls to query.filter is equivalent to filter1 AND filter2 AND ...

Filter.Term
query.filter(
    Query.Filter.Term('user', 'Kimchy')
)
Filter.Bool
query.filter(
    Query.Filter.Bool()
    .must(Query.Filter.Term('user', 'Kimchy'))
    .mustNot(Query.Filter.Term('user', 'Kimchy'))
)

FAQs

Last updated on 16 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc