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

backbone-db-elasticsearch

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-db-elasticsearch - npm Package Compare versions

Comparing version 0.1.10 to 0.1.12

11

index.js

@@ -187,3 +187,7 @@ var _ = require('lodash');

}
callback(null, convertMsearchResults(resp.responses));
var responses = convertMsearchResults(resp.responses);
if (responses && options && options.limit && Number(options.limit) < responses.length) {
responses = _.first(responses, options.limit);
}
callback(null, responses);
});

@@ -198,4 +202,7 @@ },

options = options || {};
var indexName = model.searchOptions.indexAlias
? model.searchOptions.indexAlias
: this.name + this.prefixSeparator + model.searchOptions.index;
var esData = {
index: this.name + this.prefixSeparator + model.searchOptions.index,
index: indexName,
type: model.type.toLowerCase(),

@@ -202,0 +209,0 @@ };

2

package.json
{
"name": "backbone-db-elasticsearch",
"version": "0.1.10",
"version": "0.1.12",
"description": "Elasticsearch driver for backbone-db",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -37,2 +37,9 @@ var elasticsearch = require('elasticsearch');

var CustomIndexModel = TestModel.extend({
type: 'another',
searchOptions: {
indexAlias: 'elasticsearch-test__custom_index'
}
});
var TestCollection = Collection.extend({

@@ -52,2 +59,3 @@ url: function() {

this.AnotherModel = AnotherModel;
this.CustomIndexModel = CustomIndexModel;
this.db = db;

@@ -54,0 +62,0 @@ this.Collection = TestCollection;

@@ -13,2 +13,3 @@ var setup = require('./setup');

self.AnotherModel = this.AnotherModel;
self.CustomIndexModel = this.CustomIndexModel;
self.Collection = this.Collection;

@@ -114,2 +115,9 @@ self.db = this.db;

it('should use custom index', function() {
var custom = new this.CustomIndexModel({id: 1, name: 'foo'});
return custom.save().then(function() {
return custom.destroy();
});
});
describe('Index CRUD', function() {

@@ -116,0 +124,0 @@ it('should create index', function(next) {

@@ -351,2 +351,28 @@ var setup = require('./setup');

it('should properly limit msearch w/ limit', function() {
var queriesBody = [
// match all query
{ index: 'anotheridx'},
{ query: { match_all: {} } },
// query_string query, on index/type
{ index: 'testidx', type: 'test' },
{
query: {
query_string: { query: '"abc"' }
},
size: 1
}
];
collection = new this.Collection();
return collection
.fetch({
msearch: true,
limit: 1,
body: queriesBody
})
.then(function() {
collection.length.should.equal(1);
});
});
it('should do msearch /w function_score', function() {

@@ -353,0 +379,0 @@ var queriesBody = [

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