pub enum ApiError {
IndexNotFound {
index: String,
},
DocumentMissing {
index: String,
},
IndexAlreadyExists {
index: String,
},
Parsing {
line: u64,
col: u64,
reason: String,
},
MapperParsing {
reason: String,
},
ActionRequestValidation {
reason: String,
},
Other(Map<String, Value>),
// some variants omitted
}Expand description
A REST API error response.
Variants§
IndexNotFound
An index wasn’t found.
Some endpoints, like search, will return an IndexNotFound error if a request is made to a missing index.
Other endpoints will return a successful response even if the index is missing but include some error property in the response body.
DocumentMissing
A document wasn’t found.
This error can occur when attempting to update a document that doesn’t already exist.
IndexAlreadyExists
An index already exists but was expected to.
Attempting to create an index with a name that’s already in use will result in an IndexAlreadyExists error.
Parsing
The request body contains invalid data.
If a Query DSL query contains invalid JSON or unrecognised properties then Elasticsearch will return a Parsing error.
MapperParsing
The document mapping contains invalid data.
If a put mapping request contains invalid JSON or unrecognised properties then Elasticsearch will return a MapperParsing error.
ActionRequestValidation
The request body can’t be processed.
Some endpoints that expect certain constraints of a request to hold will return an ActionRequestValidation error if those constraints aren’t met.
Other(Map<String, Value>)
A currently unrecognised error occurred.
WARNING: Don’t rely on this variant to capture an error.
As new variants are introduced they will no longer be matched by ApiError::Other.
For this reason, this variant will disappear in the future.