Hi,
I am running a 7.10 Stack with Security enabled and I am currently playing around with the ElasticSearch REST API for creating users, roles and so on. The usecase here is to add advanced information to the security objects(like description, the team it belongs to, last change date, ...).
For this, I use the metadata fields which works fine for adding information but I cannot find a way to remove the fields. Add a custom field to an existing user:
PUT _security/user/testusr
{
"roles": [
"reporting_user"
],
"metadata": {
"description": "abcdef"
}
}
=> the field metadata.description
now contains the value abcdef
.
Here is what I tried so far to remove the field:
- remove the custom field from the request
PUT _security/user/testusr
{
"roles": [
"reporting_user"
],
"metadata": {
}
}
=> the field metadata.description
still contains the value abcdef
.
2. set custom field to null
PUT _security/user/testusr
{
"roles": [
"reporting_user"
],
"metadata": {
"description": null
}
}
=> the field metadata.description
still exists - now with a null
value.
3. remove metadata element in request
PUT _security/user/testusr
{
"roles": [
"reporting_user"
]
}
=> the field metadata.description
is gone but all other metadata fields too.
How can I remove a metadata field without removing the others?
Is it a feature that not supplying the metadata in the request removes all stored metadata or is it a bug? I would expect it to behave the same as providing an empty metadata element.
Best regards
Wolfram