|
|
|
@ -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:
|
|
|
|
|