New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate the way we expose additional information on serialized Exceptions on the rest layer #27672
Comments
{"error":"alias [unknown-alias] missing","status":404} The way NEST currently deals with this is to map it as it if it were returned as: {
"errror" : {
"reason" : "alias [unknown-alias] missing"
}
} |
Possibly related to #22928 |
We discussed this in FixItFriday and were generally positive on the idea. I broke this down to #27724, #27728 and #27729, and #22928 is a pre-existing task that takes us in the right direction. There are a number of different |
|
The 4th point is about the appearant similarity of all |
When a request results in an exception it is presented back to the user as:
Notes:
caused_by
to N levels deep. These nested errors will never have aroot_cause
set.stack_trace
string can be returned whenerror_trace=true
is specified on the url.So far this is very straight forward, there are however 3 different ways additional properties can end up under
error
.1.
Headers
returned as
headers
object onerror
, usingaddHeader()
onElasticsearchException
Ingest newCompoundProcessorException()
Ingest addHeadersToException() (ConfigurationUtil clas)
Security Token Service
WWW-Authenticate
: string (Bearer).These headers are also presented as
HTTP Headers
, are these duplicated here for clients that can not access HTTP Headers? Do we really need the Ingest related headers?2.
Exceptions addMetadata()
returned as additional properties on
error
directly, using addMetadata()LicenseUItils.newComplianceException
license.expired.feature
: stringElasticsearchException.setIndex
index
: stringindex_uuid
: stringElasticsearchException.setResources
resource.type
: string (could only find the following types: "index_expression", "index_or_alias", "aliases")resource.id
: string or string[]Not entirely sure what constitutes a
resource
but this reads like a normalization attempt at additional data's keys does anyone recall the idea behind this?ElasticsearchException.setShard
shard
: string (int to string)3a.
Exceptions overriding metaDataToXContent()
SearchParseException
line
: intcol
: int;ParsingException
line
: intcol
: int;CircuitBreakException
bytes_wanted
: longbytes_limit
: long;ScriptException
script_stack
: string or string[]script
: string;lang
: string;SearchPhaseException
phase
: stringgrouped
: bool (controlled by group_shard_failures dfaults to true);failed_shards
: ShardOperationFailedException[] (controlled by group_shard_failures dfaults to true);3b.
ShardOperationFailedException.toXContent
ShardOperationFailedException
implements XContent so they also add additional fields to the nested
ElasticsearchException
underfailed_shards
DefaultShardOperationFailedException
shard
: int (note that this conflicts withsetShard()
onElasticsearchException
index
: stringstatus
: string (RestStatus.name)reason
: ElasticsearchException^ I think it would make sense if we include
type
and renamereason
tocaused_by
so that it can be parsed as anyother
ElasticsearchException
ShardSearchFailure
shard
: int (note that this conflicts withsetShard()
onElasticsearchException
index
: stringnode
: stringreason
: ElasticsearchExceptionreason
=>caused_by
SnapshotShardFailure
index
: stringindex_uuid
: string (returns getIndexName() just likeindex
?)shard_id
: intreason
: stringnode_id
: stringstatus
: string (RestStatus.name)shard_id
here should really beshard
for consistencyreason
is a string here butElasticsearchException
in otherShardOperationFailedException
implementationsReplicationResponse.ShardInfo.Failure
_index
: string_shard
: string_node
: stringprimary
: boolstatus
: string (RestStatus.name)reason
: ElasticsearchExceptionIndicesShardStoresResponse.Failure
node
: string^ Inherits from
DefaultsShardOperationFailedException
and calls its toXContentNote we have now three different ways to serialize node id's (_node, node and node_id). Same goes for shard ids.
I think the latter three are never part of
failed_shards
onSearchPhaseException
so it might make sense to introduce a seperateSearchShardOperationFailedException
interface.4. Failures
Several api's return a collection
failures
that maps to elasticsearch'sFailure
java class which currently writes exceptions as:index
: stringtype
: stringid
: boolstatus
: string (RestStatus.name)cause
: ElasticsearchExceptionNote that the
cuase
property prevents this class from being a superset ofElasticsearchException
deserialization which usescaused_by
. It'd be good to normalize these.The text was updated successfully, but these errors were encountered: