anchor.diff:  [authenticate via an API Key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html).
   
   [source,python]
  -----------------------------
  +----
   from elasticsearch import Elasticsearch
   
   # Adds the HTTP header 'Authorization: ApiKey <base64 api_key.id:api_key.api_key>'
   es = Elasticsearch(
  +    "https://localhost:9200",
  +    ca_certs="/path/to/http_ca.crt",
       api_key=("api_key.id", "api_key.api_key")
   )
  -----------------------------
  +----
   
   [discrete]
   [[compatibility-mode]]
  
positive.code: and https://www.elastic.co/guide/en/elasticsearch/reference/master/security-api-get-token.html[Bearer Tokens].
  
  [source,python]
  ----------------------------
  from elasticsearch import Elasticsearch
  
  # Adds the HTTP header 'Authorization: Bearer token-value'
  es = Elasticsearch(
      bearer_auth="token-value"
  )
  ----------------------------
  
  
  [discrete]
  
negative.code:         index="example-index",
          document={"field": i}
      )
  ----
  
  
  [discrete]
  