Skip to content

Field capabilities API drops shard level exceptions #68994

@cbuescher

Description

@cbuescher

This is a follow up to #68904 where I observed that exceptions thrown on the shard level by the field_caps API are not properly propagated to the caller. Instead we return an empty response. This didn't seem to have been a great issue so far since the biggest error source would have been the only request body parameter, the index_filter section, which typically gets parsed and validated already on the coordinating node and then everything is fine.
With introducing the runtime_mappings section it is now more likely to have errors in there too, but this part of the request doesn't get properly parsed until it reaches the shard (since we need an SearchExecutionContext to parse it). When there are errors here, usually a MapperParserException is thrown, like for the following request:

PUT /my-index/_doc/1
{
  "timestamp": "2012-01-01"
}

POST /my-index/_field_caps?fields=*
{
  "runtime_mappings": {
    "day_of_week": {
      "type": "bad_type",     <---- problem here
      "script": {
        "source": "emit(doc['timestamp'].value.dayOfWeekEnum.getDisplayName(TextStyle.FULL, Locale.ROOT))"
      }
    }
  }
}

Currently we get an empty respone ({ "indices" : [ ], "fields" : { }}) here instead of throwing an error like e.g. in the _search API for the same wrong runtime_mappings definition.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions