异常与警告
API 错误
这些错误由非 2XX 的 HTTP 响应触发:
- class elasticsearch.ApiError
- class elasticsearch.NotFoundError
表示404状态码的异常。
- __init__(message, meta, body, errors=())
- Parameters:
message (str)
meta (ApiResponseMeta)
body (Any)
- classmethod __new__(*args, **kwargs)
- class elasticsearch.ConflictError
表示409状态码的异常。
- __init__(message, meta, body, errors=())
- Parameters:
message (str)
meta (ApiResponseMeta)
body (Any)
- classmethod __new__(*args, **kwargs)
- elasticsearch.RequestError
alias of
BadRequestError
- class elasticsearch.AuthenticationException
表示401状态码的异常。
- __init__(message, meta, body, errors=())
- Parameters:
message (str)
meta (ApiResponseMeta)
body (Any)
- classmethod __new__(*args, **kwargs)
传输和连接错误
这些错误是在收到 HTTP 响应之前发生错误时触发的:
- class elasticsearch.TransportError
Generic exception for the ‘elastic-transport’ package.
For the ‘errors’ attribute, errors are ordered from most recently raised (index=0) to least recently raised (index=N)
If an HTTP status code is available with the error it will be stored under ‘status’. If HTTP headers are available they are stored under ‘headers’.
- classmethod __new__(*args, **kwargs)
- class elasticsearch.SerializationError
Error that occurred during the serialization or deserialization of an HTTP message body
- classmethod __new__(*args, **kwargs)
- class elasticsearch.ConnectionError
Error raised by the HTTP connection
- classmethod __new__(*args, **kwargs)