Skip to content

krillr/elasticquery.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple aggregation-centric library for querying ElasticSearch

Circle CI

CoffeeScript

ElasticQuery.js is written in CoffeeScript, and as such its API is geared towards usage in CoffeeScript. Where possible, helper utilities are provided to make it easier for pure JavaScript usage -- but keep in mind that pure JavaScript is treated as a second-class citizen.

Aggregations and Queries

Aggregations and Queries are both cloned every time you perform and operation on or with them. This is avantageous where you may want to define multiple different aggregations and mix them at query time, or if you want to predefine a base query then expand on it later in code.

Promises

The core elasticsearch client uses promises, so we do too!

Example

client = new ElasticQuery.Client

# Aggregations are defined outside of queries, so they can be reused
aggregation = new ElasticQuery.Aggregation 'myAggregation', 'stats', { field: 'number' }

# Queries are created on a specific index, for now
query = client.query 'my-index'
              .aggregate aggregation

query.execute()
    .then (response) ->
      console.log response

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors