# Any way to add properties to the User object?

**URL:** <https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135>\
**Category:** Elasticsearch\
**Created:** [October 24, 2017, 10:53pm UTC](https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135 "2017-10-24T22:53:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TJ\_Martin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tj_martin/32/23367_2.png) [@TJ\_Martin](https://discuss.elastic.co/u/TJ_Martin)\
**Post date:** [October 24, 2017, 10:53pm UTC](https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135/1 "2017-10-24T22:53:18Z")

</div>

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
}
```

---

<div class="post-metadata">

**Author:** ![TJ\_Martin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tj_martin/32/23367_2.png) [@TJ\_Martin](https://discuss.elastic.co/u/TJ_Martin)\
**Post date:** [October 24, 2017, 11:00pm UTC](https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135/2 "2017-10-24T23:00:34Z")

</div>

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"
          }
        }
      }
    }
}
```

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [October 25, 2017, 12:07am UTC](https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135/3 "2017-10-25T00:07:57Z")

</div>

> [@TJ\_Martin](#):
>
> I would like to add a first\_name field to the normal user properties of email/enabled/full\_name/roles/user\_name

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 22, 2017, 12:08am UTC](https://discuss.elastic.co/t/any-way-to-add-properties-to-the-user-object/105135/4 "2017-11-22T00:08:09Z")

</div>

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