Clean up spacing
This commit is contained in:
parent
0bf8624824
commit
9ce5d95786
|
@ -32,7 +32,7 @@ from opensearch import OpenSearch
|
|||
host = 'localhost'
|
||||
port = 9200
|
||||
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.
|
||||
# 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.
|
||||
client = OpenSearch(
|
||||
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,
|
||||
# client_cert = client_cert_path,
|
||||
# client_key = client_key_path,
|
||||
|
@ -75,10 +75,10 @@ document = {
|
|||
id = '1'
|
||||
|
||||
response = client.index(
|
||||
index=index_name,
|
||||
body=document,
|
||||
id=id,
|
||||
refresh=True
|
||||
index = index_name,
|
||||
body = document,
|
||||
id = id,
|
||||
refresh = True
|
||||
)
|
||||
|
||||
print('\nAdding document:')
|
||||
|
@ -97,16 +97,16 @@ query = {
|
|||
}
|
||||
|
||||
response = client.search(
|
||||
body=query,
|
||||
index=index_name
|
||||
body = query,
|
||||
index = index_name
|
||||
)
|
||||
print('\nSearch results:')
|
||||
print(response)
|
||||
|
||||
# Delete the document.
|
||||
response = client.delete(
|
||||
index=index_name,
|
||||
id=id
|
||||
index = index_name,
|
||||
id = id
|
||||
)
|
||||
|
||||
print('\nDeleting document:')
|
||||
|
@ -114,7 +114,7 @@ print(response)
|
|||
|
||||
# Delete the index.
|
||||
response = client.indices.delete(
|
||||
index=index_name
|
||||
index = index_name
|
||||
)
|
||||
|
||||
print('\nDeleting index:')
|
||||
|
|
Loading…
Reference in New Issue