Skip to content

Instantly share code, notes, and snippets.

@vivekpadia70
Last active June 15, 2020 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivekpadia70/13dadbe9e3fcd82f5f2e9a7e9d3dc076 to your computer and use it in GitHub Desktop.
Save vivekpadia70/13dadbe9e3fcd82f5f2e9a7e9d3dc076 to your computer and use it in GitHub Desktop.
host = '' # For example, my-test-domain.us-east-1.es.amazonaws.com
region = '' # e.g. us-west-1
service = 'es'
awsauth = AWS4Auth(settings.AWS_ACCESS_KEY, settings.AWS_SECRET_KEY, region, service)
es = Elasticsearch(
hosts = [{'host': host, 'port': 443}],
http_auth = awsauth,
use_ssl = True,
verify_certs = True,
connection_class = RequestsHttpConnection
)
# Store document to "quotes" index
es.index(index="quotes", doc_type="_doc", id=quote['id'], body=document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment