client.get: mix in source data, fix default index and type params
This commit is contained in:
10
test/fixtures/elasticsearch.js
vendored
10
test/fixtures/elasticsearch.js
vendored
@@ -26,10 +26,10 @@ Client.prototype.ping = function () {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.prototype.get = function (params = {}, source = false) {
|
Client.prototype.get = function (params = {}, source = {}) {
|
||||||
if (params === elasticsearch.errors.NotFound) return elasticsearch.errors.NotFound;
|
if (params === elasticsearch.errors.NotFound) return elasticsearch.errors.NotFound;
|
||||||
|
|
||||||
const _source = source || {
|
const _source = Object.assign({
|
||||||
payload: {
|
payload: {
|
||||||
id: 'sample-job-1',
|
id: 'sample-job-1',
|
||||||
now: 'Mon Apr 25 2016 14:13:04 GMT-0700 (MST)'
|
now: 'Mon Apr 25 2016 14:13:04 GMT-0700 (MST)'
|
||||||
@@ -40,11 +40,11 @@ Client.prototype.get = function (params = {}, source = false) {
|
|||||||
attempts: 0,
|
attempts: 0,
|
||||||
max_attempts: 3,
|
max_attempts: 3,
|
||||||
status: 'pending'
|
status: 'pending'
|
||||||
};
|
}, source);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_index: params.index,
|
_index: params.index || 'index',
|
||||||
_type: params.type,
|
_type: params.type || 'type',
|
||||||
_id: params.id || 'AVRPRLnlp7Ur1SZXfT-T',
|
_id: params.id || 'AVRPRLnlp7Ur1SZXfT-T',
|
||||||
_version: params.version || 1,
|
_version: params.version || 1,
|
||||||
found: true,
|
found: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user