Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
/custom/mapreduce/getresults/{jobid_or_jobtitle}?limit=200
Info

Returns the results of a map reduce job.

...

Required, see Auth - Login.

Arguments

jobid _or_jobtitle (required)
The id or title of a job you want the results of. You can find the id by writing it down when submitting a job or using Get Jobs.

find (optional)
A string representing a MongoDB query (in JSON format) that is applied to the results of the custom table. WARNING: for large custom tables, will be really slow unless the field (/fields) is (/are) indexed via "$output.indexes" or "$output.sortField" (see Schedule Job API call)

Warning

Note that MongoDB uses some JSON extensions that must be used in queries from the command line:

  • When querying the ObjectId type (eg "_id"), it should be queried as the object '{ "$oid": "<object id string>"' }'
  • When querying a Date type, it should be queried as the object '{ "$date": "<date in Java time, ie milliseconds since 01 Jan 1970" }'

The full list is here: http://docs.mongodb.org/manual/reference/mongodb-extended-json/

 

sort (optional)
A string representing a MongoDB sort operator (in JSON format). WARNING: for large custom tables, will be really slow or fail unless the field (/fields) is (/are) indexed via "$output.indexes" or "$output.sortField" (see Schedule Job API call)

Info

You can always use sort={_id:1} or sort={_id:-1} to view the first or last records.

limit (optional)
An integer of how many results you want retrieved from the database, results will be grabbed in whatever order they have been stored in the db.

Example

http://infinite.ikanow.com/api/custom/mapreduce/getresults/4e9c77ef17ef3523b657a890?limit=200   

 http://infinite.ikanow.com/api/custom/mapreduce/getresults/4e9c77ef17ef3523b657a890?limit=10&find={'indexed.field':'VALUE'}
http://infinite.ikanow.com/api/custom/mapreduce/getresults/customjob1
?limit=50&sort={'sort.field':-1}

cURL Example

Example Response
Info
Code Block

{"response":{"action":"Custom Map Reduce Job Results","success":true,"message":"Map reduce job completed at: 123456789","time":98},"data":{ "_id" : "a", "value" : 2 }}
Error Response
Info
Code Block

{"response":{"action":"Custom Map Reduce Job Results","success":false,"message":"Job does not exist","time":98}}