How to use the elasticsearch Attachment Processor with node.js

The code posted was the only one I found by example and apparently would do what I like: Read the contents of a pdf file and make it available for search.

But it does not fulfill what you would like, so I would like an example equivalent to the code made available in the documentation for the elasticsearch plugin.