import pymongo
try:
#conn = pymongo.MongoClient('mongodb://{user}:{password}@127.0.0.1:27017')
conn = pymongo.MongoClient('mongodb://127.0.0.1:27017')
db = conn.get_database('testdb')
collection = db.get_collection('testcollection')
for x in collection.find():
print(x)
except Exception as e:
print("Error while fetching Schema")
print(e)
from elasticsearch import Elasticsearch
try:
es = Elasticsearch('192.168.123.50:9200')
# elastic info
print(es.info())
# get all index
print(list(es.indices.get_alias().keys()))
print(es.indices.get_mapping("products"))
print(es.indices.get_mapping("work"))
except Exception as e:
print("Error while fetching Schema")
print(e)