我使用ES的python API来发送请求,我尝试获取我的答案的结果,但它是错误的。 我用这个代码:Elasticsearch和Python:获取总变量
import elasticsearch
es = elasticsearch.Elasticsearch(["127.0.0.1:9200"])
results = es.search(index="bhinneka", body={"query": {"match": {"name": '"'+reference+'"'}}})
if results['hits']:
print('-' * 80)
print results['hits']['total']
for hit in results['hits']['hits']:
print hit['_source']['name']
事实上,当我从我的网页浏览器验证的结果,我已经得到了 - 因为在5例 - 总变,我的代码我已经得到了在总42例如 - 。
如果有人回答这个谜,我很感兴趣:)
在此先感谢
如何验证Web浏览器的结果?也许你使用一个插件,一次返回5个结果? – Ashalynd