add worker query for outstanding jobs

This commit is contained in:
2016-04-26 17:40:14 -07:00
parent f1dc6e60dc
commit 0f3b21f1e8

View File

@@ -27,7 +27,34 @@ export default class Job extends events.EventEmitter {
}
_processJobs() {
const query = {};
const query = {
query: {
bool: {
must: [{ term: { _type: 'example' } }],
should: [
{ bool: {
must: [{ term: { status: 'pending'} }]
}},
{ bool: {
must: [
{ term: { status: 'processing'}}
],
filter: {
range: {
process_expiration: {
lte: '2016-04-26T23:40:47.820Z'
}
}
}
}}
]
}
},
sort: [
{ priority: { order: 'asc' }},
{ created_at: { order: 'asc' }}
]
};
return this.client.search({
body: {