Update index pattern fields API

edit

Update index pattern fields API

edit

Deprecated in 8.0.0.

Use the data views API instead.

[preview] This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Update fields presentation metadata, such as count, customLabel, and format. You can update multiple fields in one request. Updates are merged with persisted metadata. To remove existing metadata, specify null as the value.

Request

edit

POST <kibana host>:<port>/api/index_patterns/index_pattern/<id>/fields

POST <kibana host>:<port>/s/<space_id>/api/index_patterns/index_pattern/<id>/fields

Path parameters

edit
space_id
(Optional, string) An identifier for the space. If space_id is not provided in the URL, the default space is used.
id
(Required, string) The ID of the index pattern fields you want to update.

Request body

edit
fields
(Required, object) the field object

Response code

edit
200
Indicates a successful call.

Examples

edit

Set popularity count for field foo:

$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields
{
    "fields": {
        "foo": {
            "count": 123
        }
    }
}

Update multiple metadata fields in one request:

$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields
{
    "fields": {
        "foo": {
            "count": 123,
            "customLabel": "Foo"
        },
        "bar": {
            "customLabel": "Bar"
        }
    }
}

Use null value to delete metadata:

$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields
{
    "fields": {
        "foo": {
            "customLabel": null
        }
    }
}

The endpoint returns the updated index pattern object:

{
    "index_pattern": {

    }
}