elasticsearch python 查询的两种方法

from elasticsearch import Elasticsearch
es = Elasticsearch
res1 = es.search(index="2018-07-31", body={"query": {"match_all": {}}})
print(es1)
{'_shards': {'failed': 0, 'skipped': 0, 'successful': 5, 'total': 5},
 'hits': {'hits': [{'_id': '1',
    '_index': '2018-07-31',
     'v_ma20': 891995.98,
     'volume': 720150.81},
    '_type': 'stock'}],
  'max_score': 1.0,
  'total': 1},
 'timed_out': False,
 'took': 1163}

result = es.get(index="2018-07-31",doc_type="stock",id=1)
posted @ 2018-08-06 17:15  luoganttcc  阅读(489)  评论(0)    收藏  举报