我使用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