feat:更新elastic模块
This commit is contained in:
@@ -3,10 +3,13 @@ from elasticsearch import Elasticsearch
|
||||
from schemas.blog_elastic import BLOG_MAPPING
|
||||
from config.logging import logger
|
||||
|
||||
ES_HOSTS = ["http://localhost:9200"]
|
||||
ES_HOSTS = "http://14.103.235.151:9200"
|
||||
ES_USER = "elastic"
|
||||
ES_PASSWORD = "19940822Cxx"
|
||||
BLOG_INDEX = "blog"
|
||||
|
||||
es = Elasticsearch(hosts=ES_HOSTS)
|
||||
# 注意Python的elasticsearch的版本要和服务器的一致
|
||||
es = Elasticsearch(ES_HOSTS, http_auth=(ES_USER, ES_PASSWORD))
|
||||
|
||||
if not es.indices.exists(index=BLOG_INDEX):
|
||||
es.indices.create(index=BLOG_INDEX, body=BLOG_MAPPING)
|
||||
|
||||
Reference in New Issue
Block a user