Spaces method and path for this operation:
post /s/{space_id}/api/data_views/data_view
Refer to Spaces for more information.
Create a data view. Data views identify the Elasticsearch data you want to explore and visualize. They can point to one or more data streams, indices, or index aliases, and use optional runtime fields to compute values at query time. Note that data views are not required for ES|QL-based visualizations. To learn more, refer to the data views documentation.
POST
/api/data_views/data_view
curl
curl \
-X POST "${KIBANA_URL}/api/data_views/data_view" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{"data_view":{"title":"logstash-*","name":"My Logstash data view"}}'
POST kbn://api/data_views/data_view
{"data_view":{"title":"logstash-*","name":"My Logstash data view"}}
Request example
Create a data view for logstash indices that includes a runtime field which extracts the shape name from a source field.
{
"data_view": {
"name": "My Logstash data view",
"runtimeFieldMap": {
"runtime_shape_name": {
"script": {
"source": "emit(doc['shape_name'].value)"
},
"type": "keyword"
}
},
"title": "logstash-*"
}
}