From 7268388dfa82d2ae63edf184a93c58b7f7ace3cf Mon Sep 17 00:00:00 2001 From: HuangHai <10402852@qq.com> Date: Mon, 23 Jun 2025 18:48:58 +0800 Subject: [PATCH] 'commit' --- dsRag/T3_LinkEs.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/dsRag/T3_LinkEs.py b/dsRag/T3_LinkEs.py index 1ddae22b..0d8b509c 100644 --- a/dsRag/T3_LinkEs.py +++ b/dsRag/T3_LinkEs.py @@ -1,16 +1,12 @@ -''' -conda activate rag -pip install elasticsearch -''' from elasticsearch import Elasticsearch import ssl import warnings - from urllib3.exceptions import InsecureRequestWarning -warnings.simplefilter("once", InsecureRequestWarning) -warnings.simplefilter("once", DeprecationWarning) -warnings.simplefilter("once", category=UserWarning) +# Suppress only the single InsecureRequestWarning from urllib3 +warnings.filterwarnings('ignore', category=InsecureRequestWarning) +warnings.filterwarnings('once', category=DeprecationWarning) +warnings.filterwarnings('once', category=UserWarning) context = ssl.create_default_context() context.check_hostname = False @@ -20,7 +16,8 @@ es = Elasticsearch( hosts="https://10.10.14.206:9200", basic_auth=("elastic", "jv9h8uwRrRxmDi1dq6u8"), ssl_context=context, - verify_certs=False + verify_certs=False, + ssl_show_warn=False # This will suppress the Elasticsearch warning ) try: