kue
kue copied to clipboard
Search active jobs
I see that with the UI there's /job/search?q= to perform a search on data properties within a job. But is there a method within kue or api to search and by active? For example, something like this would be very useful.
queue.search({status: 'active', data: {key : 'something', anotherkey : 'somethingelse'}})
indexes are currently blinded created from the job.data.
That can be a feature to index also job states... low priority until we get to an stable search index
+1 for being able to find jobs by data.
you currently can search job data ( even define which fields to index) if you disableSearch: false, please read the related section of README @bobmoff
sorry for not being clear. i ment like @btmdave was suggesting. through the queue object.
the search you are talking about is through the express http api right ?
Just to re-iterate the use case, we don't generally use the kue ui, so as-is, there's no way to perform a search. I can get active jobs using kue.jobs.active or complete jobs with kue.jobs.complete etc. The only missing piece would be a kue.jobs.search, which for that we've had to run kue ui and make an http request to the api to /job/search?q=
you can create a PR adding a search method to Queue object like https://github.com/Automattic/kue/blob/master/lib/http/routes/json.js#L269
+1 on searching on data.
I only ever have to search based on one specific key in my data structure, so might be able to work around it by only having that key in searchKeys.
Not very pretty though.
If I have a key in my data which is consistent, is there another way of finding jobs based on that key? Considering looping through all jobs to achieve it.
I wrote an article that might help solving this issue: https://medium.com/@sanchitbansal10/search-kue-jobs-by-job-data-c33972c04c6c