Spaces method and path for this operation:
Refer to Spaces for more information.
Creates a data view and returns it. Kibana generates the data view ID. If a data view with the same name already exists, the request fails with a conflict. Scripted fields are deprecated and can't be set through this API; sending scripted_fields fails with a 400.
[Required authorization] Route required privileges: indexPatterns:manage.
Body
-
When
true, allows the data view to match hidden indices. -
Field filters can be used to exclude one or more fields when fetching a document. They may contain wildcards, such as
user*which filters fields starting with 'user'.Not more than
10000elements. Minimum length of each is1, maximum length of each is1000. -
Settings for individual fields, keyed by field name. To change how Kibana displays a field from the backing indices, set its label, description, format, or popularity. To define a runtime field, use the runtime field name and set
type. -
The index pattern (Elasticsearch index expression) to use as the data source. Example: "my-index-*".
Minimum length is
1. -
The name of the data view. Example: "Sample data view".
Minimum length is
1, maximum length is256. -
The name of the time field in the index. Used for time-based filtering. Example: "@timestamp".
Responses
-
The data view was created.
Hide response attributes Show response attributes object
-
The data view definition.
Additional properties are NOT allowed.
Hide data attributes Show data attributes object
-
When
true, allows the data view to match hidden indices. -
Field filters can be used to exclude one or more fields when fetching a document. They may contain wildcards, such as
user*which filters fields starting with 'user'.Not more than
10000elements. Minimum length of each is1, maximum length of each is1000. -
Settings for individual fields, keyed by field name. To change how Kibana displays a field from the backing indices, set its label, description, format, or popularity. To define a runtime field, use the runtime field name and set
type. -
Kibana provides a unique identifier for each data view, or you can create your own.
Minimum length is
1, maximum length is256. -
The index pattern (Elasticsearch index expression) to use as the data source. Example: "my-index-*".
Minimum length is
1. -
The name of the data view. Example: "Sample data view".
Minimum length is
1, maximum length is256. -
Deprecated scripted fields, keyed by field name. This property is read-only: it is only returned in responses, and sending it in a create or update request fails with a 400.
Hide scripted_fields attribute Show scripted_fields attribute object
Deprecated -
A deprecated scripted field. Scripted fields are evaluated at query time by Elasticsearch and are read-only in this API.
Additional properties are NOT allowed.
Hide * attributes Show * attributes object
-
Add a description to the field. It's displayed next to the field on the Discover, Lens, and Data View Management pages.
Minimum length is
1. -
Create a label to display in place of the field name in Discover, Maps, Lens, Visualize, and TSVB. Useful for shortening a long field name. Queries and filters use the original field name.
Minimum length is
1. - format
object Set your preferred format for displaying the value. Changing the format can affect the value and prevent highlighting in Discover.
Any of: Boolean field formatobject Bytes field formatobject Color field formatobject Currency field formatobject Date nanos field formatobject Date field formatobject Duration field formatobject Geo point field formatobject Histogram field formatobject IP field formatobject Number field formatobject Percent field formatobject Relative date field formatobject Static lookup field formatobject String field formatobject Truncate field formatobject URL field formatobject Extensible formatobject Formats a field into a true/false value.
Formats a field into a bytes value following the numeral.js format pattern. The default pattern is defined by the format:bytes:defaultPattern advanced setting.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
-
Numeral.js format pattern. See https://www.elastic.co/docs/explore-analyze/numeral-formatting to learn more.
-
-
Value is
bytes.
Formats a field into a color value.
Hide attributes Show attributes
- params
object Required One of: Hide attributes Show attributes
-
Value is
string.
Hide attributes Show attributes
-
Value is
number. -
Numeral.js format pattern. See https://www.elastic.co/docs/explore-analyze/numeral-formatting to learn more.
Hide attributes Show attributes
-
Value is
boolean.
-
Value is
color.
Formats a field into a currency value. The format is determined by the pattern of the format:currency:defaultPattern advanced setting.
Formats a field into a date nanos value following the defined pattern.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
-
Moment.js format pattern. See https://momentjs.com/ to learn more.
Default value is
MMM D, YYYY @ HH:mm:ss.SSSSSSSSS.
-
-
Value is
date_nanos.
Formats a field into a date value following the defined pattern.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
-
Moment.js format pattern. See https://momentjs.com/ to learn more.
Default value is
MMM D, YYYY @ HH:mm:ss.SSS.
-
-
Value is
date.
Formats a field into a duration value.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attributes Show params attributes object
-
When true or not provided, the formatted duration includes a space between the value and suffix. When false, no space is included.
Default value is
true. - output_format
string Required The unit to convert the field value into for display.
Any of: Displays the duration in the largest whole unit that applies, rounded. For example: "2 hours" or "a day".
Value is
humanize.Displays the duration in the largest whole unit that applies, with decimal precision. For example: "2.35 hours".
Value is
humanize_precise.Value is
as_milliseconds.Value is
as_seconds.Value is
as_minutes.Value is
as_hours.Value is
as_days.Value is
as_weeks.Value is
as_months.Value is
as_years. -
The number of decimal places to display in the duration value.
Default value is
2. -
When true, the formatted duration includes a suffix (such as "seconds", "milliseconds", or "years"). When false or not provided, no suffix is shown.
-
When true, the formatted duration uses short suffixes (such as "s", "ms", or "h"). When false or not provided, full suffixes are used.
Default value is
false.
-
-
Value is
duration.
Formats a field into a geo point value.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
- transform
string Required The transform to apply to the geo point value.
Any of: Transforms the geo point into a string in the format "latitude,longitude". For example "40.7128,-74.0060".
Value is
lat_lon_string.Transforms the geo point into a Well-Known Text (WKT) string. For example "POINT (123.456 78.901)".
Value is
wkt.Transforms the geo point into a string in the format "latitude,longitude (degrees, minutes, seconds)". For example "40°42′50.2″N 73°59′45.6″W".
Value is
dms.Transforms the geo point into a string in the format "latitude,longitude (Military Grid Reference System)". For example "18SUJ1234567890".
Value is
mgrs.Transforms the geo point to all the previous formats. For example: "Lat Long: 40.7128,-74.0060, WKT: POINT (123.456 78.901), DMS: 40°42′50.2″N 73°59′45.6″W, MGRS: 18SUJ1234567890".
Value is
multi.
-
Value is
geo_point.
Formats a histogram field into a numeric value following the defined pattern. The default pattern is defined by format:bytes:defaultPattern, format:percent:defaultPattern or format:number:defaultPattern advanced settings depending on the selected format.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attributes Show params attributes object
-
Numeral.js format pattern. See https://www.elastic.co/docs/explore-analyze/numeral-formatting to learn more.
-
Value is
histogram.
Formats a field into a numeric value following the defined pattern. The default pattern is defined by format:number:defaultPattern advanced setting.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
-
Numeral.js format pattern. See https://www.elastic.co/docs/explore-analyze/numeral-formatting to learn more.
-
-
Value is
number.
Formats a field into a percentage value following the defined pattern. The default pattern is defined by format:percent:defaultPattern advanced setting.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
-
Numeral.js format pattern. See https://www.elastic.co/docs/explore-analyze/numeral-formatting to learn more.
-
-
Value is
percent.
Formats a field into a relative date value. For example: "1 day ago".
Formats a field into a static value based on the lookup entries or the unknown key value.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attributes Show params attributes object
-
The lookup entries to use for the static lookup. The key refers to the field value, and the value refers to the new value to display.
-
The value to display for unknown key values. If not provided, the field value will be displayed.
-
-
Value is
static_lookup.
Formats a field into a string value.
Hide attributes Show attributes
-
Additional properties are NOT allowed.
Hide params attribute Show params attribute object
- transform
string Any of: Converts the field value to lowercase. For example: "Some Text" -> "some text".
Value is
lower.Converts the field value to uppercase. For example: "Some Text" -> "SOME TEXT".
Value is
upper.Converts the field value to title case. For example: "some text" -> "Some Text".
Value is
title.Shortens each dot-separated segment of the field value to its first character, except for the last segment. For example: "dot.notated.string" -> "d.n.string".
Value is
short.Decodes the field value from base64. For example: "U29tZSBUZXh0" -> "Some Text".
Value is
base64.Decodes the field value from URL parameter. For example: "Some%20Text" -> "Some Text".
Value is
urlparam.
-
Value is
string.
Truncates the field value to the specified length. If the field value is longer than the specified length, it will be truncated and the remaining text will be replaced with "...".
Formats a field into a link, image or audio.
Hide attributes Show attributes
- params
object Required One of: Hide attributes Show attributes
-
The template to use for the label. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{url}}. For example: "{{value}}".
-
When true, the URL opens in the current tab. When false or not provided, the URL opens in a new tab.
-
Displays the field value as a hyperlink.
Value is
a. -
The template to use for the URL. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{risonValue}}. Use {{risonValue}} when embedding the field value inside Kibana app URL rison state (for example: query:'{{risonValue}}'). For example: "https://example.com/{{value}}".
Hide attributes Show attributes
-
The height of the image. If not provided, the image will be displayed at the original height.
-
The template to use for the label. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{url}}. For example: "{{value}}".
-
Displays the field value as an image.
Value is
img. -
The template to use for the URL. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{risonValue}}. Use {{risonValue}} when embedding the field value inside Kibana app URL rison state (for example: query:'{{risonValue}}'). For example: "https://example.com/{{value}}".
-
The width of the image. If not provided, the image will be displayed at the original width.
Hide attributes Show attributes
-
The template to use for the label. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{url}}. For example: "{{value}}".
-
Displays the field value as an audio player.
Value is
audio. -
The template to use for the URL. The template is a string that contains the field value. The field value is replaced with the template. The available placeholders are: {{value}}, {{rawValue}} and {{risonValue}}. Use {{risonValue}} when embedding the field value inside Kibana app URL rison state (for example: query:'{{risonValue}}'). For example: "https://example.com/{{value}}".
-
-
Value is
url.
-
-
The language of the script. Example: "painless".
Minimum length is
1, maximum length is1000. -
Adjust the popularity to make the field appear higher or lower in the fields list. By default, Discover orders fields from most selected to least selected.
Minimum value is
0. -
The script that computes the value of the scripted field. Scripted fields are deprecated; use runtime fields instead.
Minimum length is
1. -
The Kibana field type of the scripted field (e.g., "string", "number", "date", "boolean", "ip", "geo_point").
Minimum length is
1, maximum length is1000.
-
-
-
The name of the time field in the index. Used for time-based filtering. Example: "@timestamp".
-
-
The ID of the data view.
Maximum length is
1000. -
Metadata about the data view.
Additional properties are NOT allowed.
Hide meta attributes Show meta attributes object
-
Timestamp when the object was created (ISO 8601).
-
User profile ID of the user who created the object.
-
When
true, the object is managed by Kibana and cannot be edited by users. -
Identifier of the plugin or team that owns this object.
-
The IDs of the spaces where the data view is available.
Not more than
100elements. Maximum length of each is1000. -
Timestamp when the object was last updated (ISO 8601).
-
User profile ID of the user who last updated the object.
-
Internal version identifier for optimistic concurrency control.
-
-
-
The request is invalid, for example when a field format type does not exist.
-
forbidden
-
A data view with the same name already exists.
curl \
--request POST 'https://localhost:5601/api/data_views/v2' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--header "kbn-xsrf: true" \
--data '{
"index_pattern": "logs-*",
"name": "Web logs",
"time_field": "@timestamp"
}'
{
"index_pattern": "logs-*",
"name": "Web logs",
"time_field": "@timestamp"
}
{
"data": {
"index_pattern": "logs-*",
"name": "Web logs",
"time_field": "@timestamp"
},
"id": "c0ffee00-d57a-11ef-9a52-4f3c2a8d0e1b",
"meta": {
"managed": false,
"spaces": [
"default"
],
"version": "WzEsMV0="
}
}