2

I'm trying to load the data into AWS elasticsearch using python

Here is what I'm doing

I have connected to AWS auth and Elasticsearch service using the elasticsearch module and used the elasticsearch endpoint as host.

here is the code:

awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service)

es = Elasticsearch(
    hosts = [{'host': host, 'port': 443}],
    http_auth = awsauth,
    use_ssl = True,
    verify_certs = True,
    connection_class = RequestsHttpConnection
)

document = {
    "title": "Moneyball",
    "director": "Bennett Miller",
    "year": "2011"
}

es.index(index="movies", doc_type="_doc", id="5", body=document)

I'm getting the following error:

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(
elasticsearch.exceptions.RequestError: RequestError(400, 'no handler found for uri [/:443/movies/_doc/5] and method [PUT]', 'no handler found for
uri [/:443/movies/_doc/5] and method [PUT]')

How to resolve this?

And also is there any other way to put the data in the Elasticsearch?

Evaldas Buinauskas
  • 13,739
  • 11
  • 55
  • 107
ankur suman
  • 151
  • 1
  • 3
  • 10

0 Answers0