擅长:python、mysql、java
<p>所以流式大容量返回一个激励器。这意味着在你开始迭代之前什么都不会发生。“bulk”函数的代码如下所示:</p>
<pre><code>success, failed = 0, 0
# list of errors to be collected is not stats_only
errors = []
for ok, item in streaming_bulk(client, actions, **kwargs):
# go through request-reponse pairs and detect failures
if not ok:
if not stats_only:
errors.append(item)
failed += 1
else:
success += 1
return success, failed if stats_only else errors
</code></pre>
<p>所以基本上只调用streaming_bulk(client,actions,**kwargs)实际上不会做任何事情。直到像在这个for循环中那样迭代它,索引才真正开始发生。</p>
<p>所以在你的代码里。欢迎您将“bulk”更改为“streaming_bulk”,但是您需要迭代streaming bulk的结果,以便实际索引任何内容。</p>