Inconsistent API Response "error: no handler found for uri"

Hey, doing API POST Requests via Python (on MacOS) I did:

elastic_client.update(index='.internal.alerts-security.alerts-default-000001',id='a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7', body={"doc": {"kibana.alert.workflow_status": "acknowledged"}})

and got the response:
ObjectApiResponse({'_index': '.internal.alerts-security.alerts-default-000001', '_id': 'a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7', '_version': 2, 'result': 'noop', '_shards': {'total': 0, 'successful': 0, 'failed': 0}, '_seq_no': 4585, '_primary_term': 1})

But doing the exact same request on another machine (Ubuntu) I got:

raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info)
elasticsearch.exceptions.RequestError: RequestError(400, 'no handler found for uri [/.internal.alerts-security.alerts-default-000001/_doc/a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7/_update] and method [POST]', 'no handler found for uri [/.internal.alerts-security.alerts-default-000001/_doc/a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7/_update] and method [POST]')
>>> elastic_client.update(index='.internal.alerts-security.alerts-default-000001',id='a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7', query={"doc": {"kibana.alert.workflow_status": "acknowledged"}})

doing the same on Postman (API tool) on MacOS I got the same error response:

http://10.24.1.5:9200/.internal.alerts-security.alerts-default-000001/_doc/a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7/_update
{
    "error": "no handler found for uri [/.internal.alerts-security.alerts-default-000001/_doc/a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7/_update] and method [POST]"
}

It seems to only work on my local machines python instance.

Did I do something wrong?

What version of the stack?
What version of python and postman?

Oh sorry forgot that:

ELK is on 8.0
Postman version 8.12.4 (8.12.4)
Python on MacOS: 3.9.10
Python on Linux: 3.8.10

Update API document says the request be:
POST /<index>/_update/<_id>

Your url looks a bit different as:
POST /<index>/_doc/<_id>/_update

Try:
/.internal.alerts-security.alerts-default-000001/_update/a9136c19ccfd95123cb2cf5697affbbdeb5a35c785ced06071f2777881aa33f7

1 Like

Yes that works thank you. But maybe the python command needs fixing then.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.