Skip to content

SecurityRealm type in SecurityPutRoleMappingRequest results in a parsing error. #2344

@kristianthorsen

Description

@kristianthorsen

🐛 Bug Report

The SecurityPutRoleMappingRequest type expects to specify a SecurityRealm in a SecurityFieldRule of a SecurityRule as:

  {
  field: {
    realm: {
      name: "RealmName"
    }
  }
}

However doing this results in the following parsing error:

Error: parsing_exception
Caused by:
x_content_parse_exception: [1:77] [role-mapping] failed to parse field [rules]
Root causes:
parsing_exception: [1:77] [role-mapping] failed to parse field [rules]

I have played a bit around with it and got the desired behaviour by changing the input to:

  {
  field: {
    "realm.name": "RealmName"
  }
}

It seems that the type SecurityRealm type should either be changed to use "realm.name" or handle the behaviour before forwarding the body to the api.

To Reproduce

Attempt to call the elasticsearch client with .security.putRoleMapping() containing the input described above

Expected behavior

I expected the elasticsearch client to map the specified type to an accepted api request before forwarding the apicall.

Your Environment

  • node version: ">=18.0.0"
  • @elastic/elasticsearch version: "^8.7.0"
  • os: Linux

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions