One thread per-doc id? This doesn't sound like it scales really well. Have you tested this with millions of docs or something like that?