Any way to add properties to the User object?

Using 5.3.3

I would like to add a first_name field to the normal user properties of email/enabled/full_name/roles/user_name

I was able to PUT the property onto the user object at the

/.security/_mapping/user

endpoint without an issue. However attempts to post with this additional field result in this error:

{
  "error": {
    "root_cause": [
      {
        "type": "parse_exception",
        "reason": "failed to parse add user request. unexpected field [first_name]"
      }
    ],
    "type": "parse_exception",
    "reason": "failed to parse add user request. unexpected field [first_name]"
  },
  "status": 400
}

Seems to register fine in
/.security/_mapping/

".security": {
    "mappings": {
      "user": {
        "dynamic": "strict",
        "_meta": {
          "security-version": "5.3.3"
        },
        "properties": {
          "email": {
            "type": "text",
            "analyzer": "email"
          },
          "enabled": {
            "type": "boolean"
          },
          "first_name": {
            "type": "text"
          },
          "full_name": {
            "type": "text"
          },
          "metadata": {},
          "password": {
            "type": "keyword",
            "index": false,
            "doc_values": false
          },
          "roles": {
            "type": "keyword"
          },
          "username": {
            "type": "keyword"
          }
        }
      }
    }
}

We don't support adding new fields into the user mapping. You run the risk of breaking all sorts of things - particularly upgrades - if you fiddle with the security index mapping.

If you want to add additional data, store it in the metadata object on the user.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.