I am working on elasticsearch. I created and indexed json file content in elasticsearch.Now am trying to search text using search query.When i try to execute the below query in elasticsearch, it doesn't return anything in the result. But values are in it. Because i checked using the curl command,it return result.
I executed elasticsearch query command
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"])
it doesn't call the for loop. I don't know why
It doesn't return anything
I executed curl command
curl -XGET 'xxx.xx.xx.xx:9200/sugan/_search?'
It's getting proper result
esclient in your Python code?