import datetime import json from elasticsearch import Elasticsearch from elasticsearch import helpers index_name = 'voc_feed_card_dev' es = Elasticsearch( ['http://eip-es-2.qa.mlamp.cn:9200/'], http_auth=('voc_feed_read', 'Voc_feed_read@123456'), port=9200, use_ssl=False ) print("索引情况") print(es.cat.indices()) # print("mapping情况") res = es.indices.get_mapping(index=index_name) print(json.dumps(res, indent=2)) print("查询情况") body = { "query": { "match_all": {} } } res = es.search(index=index_name, doc_type="_doc", body=body) print(json.dumps(res, indent=2))