import json

from elasticsearch import Elasticsearch

# 创建Elasticsearch对象，并提供账号信息
es = Elasticsearch(
    ['http://114.116.19.92:9700'],  http_auth=('elastic', 'zzsn9988')  # 账号和密码
)



index_name = 'basedata'
# 搜索文档
search_query = {
    "query": {
        "match": {
            "sourceAddress": "www"
        }
    }
}
# search_query=json.dumps(search_query)
res = es.search(index=index_name, body=search_query)
for hit in res['hits']['hits']:
    print(hit['_source'])


