0

I am using botocore's AWSRequest to make calls to Elasticsearch cluster. I am using GET method on an index with _search API as follows:

req = AWSRequest(method=method, url=proto + host + urllib.parse.quote(path), data=payload,
                 headers={'Host': host, 'Content-Type': 'application/json'})

path is in the following format:

/<Document-Index>/_search?q=param:param-val

I am using:

SigV4Auth(creds, 'es', region).add_auth(req)
http_session = URLLib3Session()
res = http_session.send(req.prepare())

to make the GET call to the Elastic search endpoint. I am getting the foillowing error:

Incorrect HTTP method for uri [/<Document-Index>/_search?<query_terms>] and method [GET], allowed: [POST]",
status: 405

Can anyone help me with this?

Thanks

1
  • looks like its a POST method call while you are making a GET method call as mentioned in error msg and method [GET], allowed: [POST], can you try changing it ? Commented Nov 21, 2019 at 1:34

1 Answer 1

0

I believe your request url is not correct, print it somewhere and check. I observed exact same error when request url is - GET test_index instead of GET test_index/_search from Kibana.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.