diff --git a/src/worker.js b/src/worker.js index ae86191..3de32b1 100644 --- a/src/worker.js +++ b/src/worker.js @@ -228,6 +228,9 @@ export default class Job extends events.EventEmitter { _getPendingJobs() { const nowTime = moment().toISOString(); const query = { + _source : { + exclude: [ 'output.content' ] + }, query: { constant_score: { filter: { diff --git a/test/src/worker.js b/test/src/worker.js index 69f35a2..53d7eee 100644 --- a/test/src/worker.js +++ b/test/src/worker.js @@ -221,6 +221,13 @@ describe('Worker class', function () { clock.restore(); }); + it('should filter unwanted source data', function () { + const excludedFields = [ 'output.content' ]; + const { body } = getSearchParams(jobtype); + expect(body).to.have.property('_source'); + expect(body._source).to.eql({ exclude: excludedFields }); + }); + it('should search by job type', function () { const { body } = getSearchParams(jobtype); const conditions = get(body, conditionPath);