think_elasticsearch
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -36,2 +36,3 @@ 'use strict'; | ||
this.type = 'book'; | ||
this.id = 'user_name'; | ||
this._mapping = { | ||
@@ -38,0 +39,0 @@ user_name: { |
@@ -241,3 +241,3 @@ 'use strict'; | ||
this.queryObj.body = _lib2.default.extend(this.queryObj.body, data); | ||
this.queryObj.body = data; | ||
return this.socket().connect().then(function (conn) { | ||
@@ -244,0 +244,0 @@ console.log(_this3.queryObj); |
@@ -508,3 +508,3 @@ 'use strict'; | ||
if (!(_lib2.default.isEmpty(__data.id) && _lib2.default.isEmpty(parsedOption.match) && _lib2.default.isEmpty(parsedOption.filter))) { | ||
if (!(_lib2.default.isEmpty(__data.id) && _lib2.default.isEmpty(parsedOption.match) && _lib2.default.isEmpty(parsedOption.filter) && _lib2.default.isEmpty(parsedOption.where))) { | ||
_context5.next = 6; | ||
@@ -521,5 +521,10 @@ break; | ||
} | ||
//ES的_id项并没有在文档中,而是与index,type同级.因此通过_id更新时,不应该通过解析 | ||
//暂时将where中的参数作为id | ||
if (!_lib2.default.isEmpty(parsedOption.where) && !_lib2.default.isEmpty(parsedOption.where.id)) { | ||
parsedOption.id = parsedOption.where.id; | ||
} | ||
return _context5.abrupt('return', this.adapter().update(__data, parsedOption)); | ||
case 8: | ||
case 9: | ||
case 'end': | ||
@@ -869,6 +874,16 @@ return _context5.stop(); | ||
_class.prototype._checkData = function _checkData(data) { | ||
//判断字段默认类型合法性,此处有个问题,对于ES的mapping可关闭或开启mapping中未设置的类型 | ||
}; | ||
_class.prototype._checkData = function _checkData(data) {} | ||
//判断字段默认类型合法性,此处有个问题,对于ES的mapping可关闭或开启mapping中未设置的类型 | ||
/** | ||
* 解析数据,根据参数判断返回是否返回ES返回的相关参数,还是只返回查询结果 | ||
* @param data | ||
* @param options | ||
* @private | ||
*/ | ||
; | ||
_class.prototype._parseData = function _parseData(data, options) {}; | ||
return _class; | ||
@@ -875,0 +890,0 @@ }(_base3.default); |
{ | ||
"name": "think_elasticsearch", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "基于elasticsearch.js的elasticsearch工具", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -149,3 +149,3 @@ /** | ||
execute(data, optype = 'create') { | ||
this.queryObj.body = lib.extend(this.queryObj.body, data); | ||
this.queryObj.body = data; | ||
return this.socket().connect().then(conn=> { | ||
@@ -152,0 +152,0 @@ console.log(this.queryObj) |
@@ -295,3 +295,3 @@ /** | ||
let __data = lib.extend({}, data); | ||
if (lib.isEmpty(__data.id) && lib.isEmpty(parsedOption.match) && lib.isEmpty(parsedOption.filter)) return this.error('ES必须指定条件更新'); | ||
if (lib.isEmpty(__data.id) && lib.isEmpty(parsedOption.match) && lib.isEmpty(parsedOption.filter) && lib.isEmpty(parsedOption.where)) return this.error('ES必须指定条件更新'); | ||
if (!lib.isEmpty(__data.id)) { | ||
@@ -301,2 +301,7 @@ parsedOption.id = __data.id; | ||
} | ||
//ES的_id项并没有在文档中,而是与index,type同级.因此通过_id更新时,不应该通过解析 | ||
//暂时将where中的参数作为id | ||
if (!lib.isEmpty(parsedOption.where) && !lib.isEmpty(parsedOption.where.id)) { | ||
parsedOption.id = parsedOption.where.id; | ||
} | ||
return this.adapter().update(__data, parsedOption); | ||
@@ -408,2 +413,12 @@ } | ||
} | ||
/** | ||
* 解析数据,根据参数判断返回是否返回ES返回的相关参数,还是只返回查询结果 | ||
* @param data | ||
* @param options | ||
* @private | ||
*/ | ||
_parseData(data, options) { | ||
} | ||
} |
@@ -19,9 +19,11 @@ /** | ||
var updateData = { | ||
id: 'AVf-ys2EvuLo1zgrtaHK', | ||
username: 'ES_1' | ||
//id: 'AVf_6uxvvuLo1zgrtaIC', | ||
nick_name: '李明' | ||
} | ||
bookM.update(updateData).then(res=> { | ||
"use strict"; | ||
console.log(res) | ||
}) | ||
bookM.where({id: 'AVf_6uxvvuLo1zgrtaIC'}) | ||
.update(updateData) | ||
.then(res=> { | ||
"use strict"; | ||
console.log(res) | ||
}) |
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
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
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
638516
4712