Update data view fields APIedit

[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.

Requestedit

POST <kibana host>:<port>/api/data_views/data_view/<id>/fields

POST <kibana host>:<port>/s/<space_id>/api/data_views/data_view/<id>/fields

Path parametersedit

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 data view fields you want to update.

Request bodyedit

fields
(Required, object) the field object

Response codeedit

200
Indicates a successful call.

Examplesedit

Set popularity count for field foo:

$ curl -X POST api/data_views/data-view/my-view/fields
{
    "fields": {
        "foo": {
            "count": 123
        }
    }
}

Change a simple field format:

$ curl -X POST api/data_views/data-view/my-view/fields
{
  "fields": {
    "foo": {
      "format": {
        "id": "bytes"
      }
    }
  }
}

Change a complex field format:

$ curl -X POST api/data_views/data-view/my-view/fields
{
  "fields": {
    "foo": {
      "format": {
                "id": "static_lookup",
                "params": {
                  "lookupEntries": [
                    {
                      "key": "1",
                      "value": "100"
                    },
                    {
                      "key": "2",
                      "value": "200"
                    }
                   ],
                   "unknownKeyValue": "5000"
                }
            }
        }
    }
}

Update multiple metadata fields in one request:

$ curl -X POST api/data_views/data-view/my-view/fields
{
    "fields": {
        "foo": {
            "count": 123,
            "customLabel": "Foo"
        },
        "bar": {
            "customLabel": "Bar"
        }
    }
}

Use null value to delete metadata:

$ curl -X POST api/data_views/data-view/my-pattern/fields
{
    "fields": {
        "foo": {
            "customLabel": null
        }
    }
}

The endpoint returns the updated data view object:

{
    "data_view": {

    }
}