试着用fields=..。pyes .search中的参数失败了
下面是一个简单的测试脚本来说明这个问题:http://pastebin.com/LiRMC3ib
使用当前版本的pyes 0.19.1,此脚本输出{}作为
print resultset[0]然而,使用以前的“旧的”不稳定的0.19.1版本的pyes,我有- 0.19.1 (不稳定)的结果
print resultset[0]预期:
{u'name': u'Joe Tester'}在ES.get调用中使用字段确实有效。
其他人看到了这个,或者有一些关于发生了什么事的提示?
发布于 2014-07-22 20:50:31
重写
resultset = ES.search(query=q, indices='oolong', fields=["name"])至
resultset = ES.search(Search(q, fields=['name']), indices='oolong'))发布于 2012-12-01 22:39:31
在您的pastebin代码中,我注意到一件可以解释意外行为的事情--刷新(第37行)应该在搜索之前(第36行)。否则,如果文档已经提交到索引中,则会出现争用条件。
发布于 2013-04-12 14:41:20
我使用pyes 0.19.1也有同样的问题,但是我能够从结果集中检索一个字段。
替换这一行:
resultset = ES.search(query=q, indices='oolong', fields=["name"])对此:
resultset = ES.search(query=q, indices='oolong', fields="name")这对我有用。不过,我还没有想出如何检索多个字段。当我将一个列表传递给字段时,它总是返回空字典。
https://stackoverflow.com/questions/13530408
复制相似问题