Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elasto

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasto - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

21

lib/elasto.js
var elasticsearch = require('elasticsearch');
var helpers = require('./helpers');
var isArray = require('isarray');

@@ -64,3 +64,3 @@ var Elasto = {

if (helpers.isArray(value)) {
if (isArray(value)) {
condition.terms = {};

@@ -159,3 +159,3 @@ condition.terms[key] = value;

if (helpers.isArray(keys)) {
if (isArray(keys)) {
fields = keys;

@@ -181,3 +181,3 @@ } else {

if (key && helpers.isArray(interval)) {
if (key && isArray(interval)) {
var range = {};

@@ -340,2 +340,15 @@ range.range = {};

};
/**
* Get the number of documents matching the query
* @return Promise
* @example
* query.count().then(function(res) {
*
* });
*/
this.count = function() {
var query = this._buildQuery();
return client.count(query);
};
}

@@ -342,0 +355,0 @@

5

package.json
{
"name": "elasto",
"version": "0.1.2",
"version": "0.2.0",
"description": "ElasticSearch client",

@@ -10,3 +10,4 @@ "main": "index",

"dependencies": {
"elasticsearch": "^3.0.1"
"elasticsearch": "^3.0.1",
"isarray": "0.0.1"
},

@@ -13,0 +14,0 @@ "devDependencies": {

@@ -255,2 +255,14 @@ # Elasto [![Circle CI](https://circleci.com/gh/StreetHub/elasto.svg?style=svg)](https://circleci.com/gh/StreetHub/elasto)

### Count
Count documents based on a query
```javascript
Elasto.query({
index: 'development',
type: 'tweets'
})
.count();
```
### License

@@ -257,0 +269,0 @@ `elasto` is released under the MIT license. See `LICENSE.txt` for the complete text.

@@ -332,2 +332,14 @@ 'use strict';

it('should count documents', function(done) {
Elasto.query({
index: 'testing',
type: 'tweets'
})
.count()
.then(function(res) {
res.count.should.be.greaterThan(0);
})
.should.eventually.notify(done);
});
});

@@ -334,0 +346,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc