Map reduce on top of bucket's subset

Hi,
Let’s assume that we have a bucket with 100 docs and I want to apply my view on top of a specific well known in advance subset of the bucket. For example let’s say that I know the ids of the docs in advance.

What is the best way in order to tackle this?

Thank you in advance.

you can filter view results by those keys (not the range). see keys argument

Example.
Lets imagine we have a view, which returns results like this:

$ curl http://node.avsej.net:8092/default/_design/simple/_view/test
{"total_rows":6,"rows":[
{"id":"41070cfc-a85c-424c-9b87-fce0616c77c1","key":"2013-11-11-20-28-21","value":null},
{"id":"bb275e3c-54da-4e85-8cc3-21defff4e278","key":"2013-11-13-1-41-7","value":null},
{"id":"00000","key":"2013-11-8-1-17-46","value":null},
{"id":"a4a6cf44-8a82","key":"2013-11-8-1-17-46","value":null},
{"id":"a4a6cf44-8a82-494a-a2b9","key":"2013-11-8-1-17-46","value":null},
{"id":"a4a6cf44-8a82-494a-a2b9-f6a3ec629f17","key":"2013-11-8-1-17-46","value":null}
]
}

Then you need to leave only keys from the set [“2013-11-11-20-28-21”, “2013-11-13-1-41-7”]. Just pass it as an argument

$ curl 'http://node.avsej.net:8092/default/_design/simple/_view/test?keys=%5B%222013-11-11-20-28-21%22%2C%222013-11-13-1-41-7%22%5D'
{"total_rows":6,"rows":[
{"id":"41070cfc-a85c-424c-9b87-fce0616c77c1","key":"2013-11-11-20-28-21","value":null},
{"id":"bb275e3c-54da-4e85-8cc3-21defff4e278","key":"2013-11-13-1-41-7","value":null}
]
}

If you would like to avoid urlencoding and/or your list of keys quite big to be placed into query string, you can put keys argument into the request body (other filters still should be in query string)

$ curl -H'Content-Type: application/json' -XPOST -d'{"keys": ["2013-11-11-20-28-21","2013-11-13-1-41-7"]}' http://node.avsej.net:8092/default/_design/simple/_view/test
{"total_rows":6,"rows":[
{"id":"41070cfc-a85c-424c-9b87-fce0616c77c1","key":"2013-11-11-20-28-21","value":null},
{"id":"bb275e3c-54da-4e85-8cc3-21defff4e278","key":"2013-11-13-1-41-7","value":null}
]
}