535 B
535 B
title | updated | created |
---|---|---|
ES | 2021-05-04 14:58:11Z | 2021-05-04 14:58:11Z |
ElasticSearch
Ping a ES server
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import ConnectionError
try:
es:bool = Elasticsearch([{'host': 'localhost', 'port': 9200}]).ping()
print(es)
except ConnectionRefusedError:
print ('Connection Error!')
get default response
import requests
r:requests.models.Response = requests.get('http://localhost:9200')
print(r)
r.headers
r.content