我正在研究elasticsearch。我在elasticsearch中创建并索引了json文件内容。现在我试图使用搜索查询来搜索文本。当我尝试在elasticsearch中执行下面的查询时,它不会返回结果中的任何内容。但价值在其中。因为我使用curl命令进行检查,所以它返回结果。搜索查询不会返回elasticsearch中的任何内容
我执行elasticsearch查询命令
ES_HOST = {"host":"xxx.xx.xx.xx","port":"9200"}
ES_INDEX = 'sugan'
ES_TYPE = 'doc'
es = Elasticsearch(hosts=[ES_HOST])
res = es.search(index=ES_INDEX,body={"query":{"match_all":{}}})
when i print **res**, it's response like below
Search Response:'{u'hits': {u'hits': [], u'total': 0, u'max_score': None}, u'_shards': {u'successful': 1, u'failed': 0, u'total': 1}, u'took': 1, u'timed_out': False}'
for hit in result['hits']['hits']:
print "results:"
print (hit["_source"])
它不调用for循环。我不知道为什么
它不返回任何
我执行卷曲命令
curl -XGET 'xxx.xx.xx.xx:9200/sugan/_search?'
它越来越正确的结果
你能告诉你如何设置您'es'您的客户端Python代码? – Val