Comparing version 1.1.1 to 1.1.2
@@ -255,3 +255,3 @@ var elasticsearch = require('elasticsearch'); | ||
this._buildQuery = function() { | ||
this._buildQuery = function(opts) { | ||
var query = { | ||
@@ -306,3 +306,3 @@ index: index, | ||
if (options.fields.length) query.fields = options.fields; | ||
if (options.sort.length) body.sort = options.sort; | ||
if (options.sort.length && opts.output === 'search') body.sort = options.sort; | ||
if (options.size) query.size = options.size; | ||
@@ -326,3 +326,3 @@ if (options.from) query.from = options.from; | ||
this.exec = function() { | ||
var query = this._buildQuery(); | ||
var query = this._buildQuery({output: 'search'}); | ||
return client.search(query); | ||
@@ -340,3 +340,3 @@ }; | ||
this.count = function() { | ||
var query = this._buildQuery(); | ||
var query = this._buildQuery({output: 'count'}); | ||
return client.count(query); | ||
@@ -343,0 +343,0 @@ }; |
{ | ||
"name": "elasto", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "ElasticSearch client", | ||
@@ -5,0 +5,0 @@ "main": "index", |
@@ -17,2 +17,5 @@ 'use strict'; | ||
var CIRCLECI = process.env.CIRCLECI === "true"; | ||
console.log('Executing test on', CIRCLECI ? 'CircleCI' : 'local'); | ||
describe('Elasto', function() { | ||
@@ -26,2 +29,3 @@ | ||
before(function cleanTestingIndex(done) { | ||
this.timeout(60000); | ||
@@ -34,5 +38,9 @@ var mapping = { | ||
Elasto.client.indices.exists({ index: 'testing'}) | ||
// Circle ci takes a few seconds to start the elasticsearch service | ||
Bluebird.resolve().delay(CIRCLECI ? 10000 : 0) | ||
.then(function() { | ||
return Elasto.client.indices.exists({ index: 'circle_test'}); | ||
}) | ||
.then(function(exists) { | ||
var deleteIndex = Elasto.client.indices.delete({ index: 'testing'}); | ||
var deleteIndex = Elasto.client.indices.delete({ index: 'circle_test'}); | ||
return exists ? deleteIndex : ''; | ||
@@ -42,7 +50,7 @@ }) | ||
.then(function(){ | ||
return Elasto.client.indices.create({ index: 'testing' }); | ||
return Elasto.client.indices.create({ index: 'circle_test' }); | ||
}) | ||
.then(function(){ | ||
return Elasto.client.indices.putMapping({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets', | ||
@@ -78,3 +86,3 @@ body: { | ||
promises.push(Elasto.client.create({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets', | ||
@@ -96,3 +104,3 @@ refresh: true, | ||
Elasto.client.create({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets', | ||
@@ -105,3 +113,3 @@ refresh: true, | ||
return Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -124,3 +132,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -139,3 +147,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -162,3 +170,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -183,3 +191,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -198,3 +206,3 @@ }) | ||
return Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -217,3 +225,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -236,3 +244,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -254,3 +262,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -274,3 +282,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -292,3 +300,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -311,3 +319,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -324,3 +332,3 @@ }) | ||
return Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -345,3 +353,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -354,3 +362,3 @@ }) | ||
docs: Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -372,3 +380,3 @@ }) | ||
Elasto.query({ | ||
index: 'testing', | ||
index: 'circle_test', | ||
type: 'tweets' | ||
@@ -375,0 +383,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26633
614
2