[英]Node.js harmony: How to yield elasticsearch.js calls (using koa)
After an hour of trying various syntaxes and npm modules: 经过一个小时的尝试,各种语法和npm模块:
How would I achieve yielding a call to the elasticsearch client? 如何取得对Elasticsearch客户的呼叫? I'm looking at something like this: 我在看这样的东西:
var res = yield *client.get({
index: index,
type: type,
id: id,
ignore: [404]
})
I have no idea what res should or would be, but I need to know if the document was found/exists. 我不知道res应该是或应该是什么,但是我需要知道该文档是否已找到/存在。
Edit: Got it working with require('thunkify-wrap').genify(client.get)
. 编辑:与require('thunkify-wrap').genify(client.get)
。 Now both yield client.get({...})
AND yield *client.get({...})
works. 现在, yield client.get({...})
和yield *client.get({...})
可以工作。 Beats me. 甘拜下风。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.