Clean up spacing

This commit is contained in:
aetter 2021-08-19 13:23:14 -07:00
parent 0bf8624824
commit 9ce5d95786
1 changed files with 11 additions and 11 deletions

View File

@ -32,7 +32,7 @@ from opensearch import OpenSearch
host = 'localhost' host = 'localhost'
port = 9200 port = 9200
auth = ('admin', 'admin') # For testing only. Don't store credentials in code. auth = ('admin', 'admin') # For testing only. Don't store credentials in code.
ca_certs_path = '/full/path/to/root-ca.pem' # Provide a CA bundle if you use intermediate CAs with your root CA ca_certs_path = '/full/path/to/root-ca.pem' # Provide a CA bundle if you use intermediate CAs with your root CA.
# Optional client certificates if you don't want to use HTTP basic authentication. # Optional client certificates if you don't want to use HTTP basic authentication.
# client_cert_path = '/full/path/to/client.pem' # client_cert_path = '/full/path/to/client.pem'
@ -41,7 +41,7 @@ ca_certs_path = '/full/path/to/root-ca.pem' # Provide a CA bundle if you use int
# Create the client with SSL/TLS enabled, but hostname verification disabled. # Create the client with SSL/TLS enabled, but hostname verification disabled.
client = OpenSearch( client = OpenSearch(
hosts = [{'host': host, 'port': port}], hosts = [{'host': host, 'port': port}],
http_compress=True, # enables gzip compression for request bodies http_compress = True, # enables gzip compression for request bodies
http_auth = auth, http_auth = auth,
# client_cert = client_cert_path, # client_cert = client_cert_path,
# client_key = client_key_path, # client_key = client_key_path,
@ -75,10 +75,10 @@ document = {
id = '1' id = '1'
response = client.index( response = client.index(
index=index_name, index = index_name,
body=document, body = document,
id=id, id = id,
refresh=True refresh = True
) )
print('\nAdding document:') print('\nAdding document:')
@ -97,16 +97,16 @@ query = {
} }
response = client.search( response = client.search(
body=query, body = query,
index=index_name index = index_name
) )
print('\nSearch results:') print('\nSearch results:')
print(response) print(response)
# Delete the document. # Delete the document.
response = client.delete( response = client.delete(
index=index_name, index = index_name,
id=id id = id
) )
print('\nDeleting document:') print('\nDeleting document:')
@ -114,7 +114,7 @@ print(response)
# Delete the index. # Delete the index.
response = client.indices.delete( response = client.indices.delete(
index=index_name index = index_name
) )
print('\nDeleting index:') print('\nDeleting index:')