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

think_elasticsearch

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

think_elasticsearch - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

32

lib/Adapter/elasticsearch.js

@@ -266,2 +266,27 @@ 'use strict';

/**
* 直接根据id查询
* @param _id
*/
_class.prototype.get = function get(_id) {
var _this4 = this;
return this.socket().connect().then(function (conn) {
return _this4.socket().connect().then(function (conn) {
var condition = {
index: _this4.queryObj.index,
type: _this4.queryObj.type,
id: _this4.queryObj.body.query.id
};
_this4.logSql && _lib2.default.log((0, _stringify2.default)(condition), 'ES', Date.now());
return conn.get(condition);
}).then(function (data) {
//this.close();
return data;
});
});
};
/**
* 创建索引

@@ -545,3 +570,8 @@ * @param index

this.queryBuilder(opitons, 'select');
return this.query();
//如果存在_id项,则直接查询
if (opitons.hasOwnProperty('where') && (opitons.where.hasOwnProperty('_id') || opitons.where.hasOwnProperty('id'))) {
return this.get(opitons.where.hasOwnProperty('_id') || opitons.where.hasOwnProperty('id'));
} else {
return this.query();
}
};

@@ -548,0 +578,0 @@

2

package.json
{
"name": "think_elasticsearch",
"version": "1.0.15",
"version": "1.0.16",
"description": "基于elasticsearch.js的elasticsearch工具",

@@ -5,0 +5,0 @@ "scripts": {

@@ -174,2 +174,23 @@ /**

/**
* 直接根据id查询
* @param _id
*/
get(_id) {
return this.socket().connect().then(conn=> {
return this.socket().connect().then(conn=> {
let condition = {
index: this.queryObj.index,
type: this.queryObj.type,
id: this.queryObj.body.query.id
}
this.logSql && lib.log(JSON.stringify(condition), 'ES', Date.now());
return conn.get(condition);
}).then(data=> {
//this.close();
return data;
})
})
}
/**
* 创建索引

@@ -420,3 +441,8 @@ * @param index

this.queryBuilder(opitons, 'select');
return this.query();
//如果存在_id项,则直接查询
if (opitons.hasOwnProperty('where') && (opitons.where.hasOwnProperty('_id') || opitons.where.hasOwnProperty('id'))) {
return this.get(opitons.where.hasOwnProperty('_id') || opitons.where.hasOwnProperty('id'));
} else {
return this.query();
}
}

@@ -423,0 +449,0 @@

@@ -12,3 +12,3 @@ /**

db_type: 'es', // 数据库类型
db_host: '192.168.1.1', // 服务器地址
db_host: '', // 服务器地址
db_port: '9200', // 端口

@@ -29,12 +29,12 @@ db_log: 'info'

//})
.setIndex('am')
.setType()
.limit(1, 1000)
.setIndex('am_test')
.setType('list')
.where({id: '5e97ab25b4620e6a7f027647e6dc3615'})
//.field('goods,price')
.selectAll().then(res => {
//console.log(res.hits.hits.length)
res.hits.hits.map(item=> {
"use strict";
console.log(item)
})
.find().then(res => {
console.log(res)
//res.hits.hits.map(item=> {
// "use strict";
// console.log(item)
//})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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