Kibana Data View update API request doesn't work

I'm using latest version of 8.6.2 kibana and i need to change the index pattern in kibana Data View to visualize data dynamically. so i have to do it using kibana rest API and found Data View Update API Documentation. but when I run update request on dev tools for existing Data view id, it shows not found error.
image

here the request sent from dev tools

POST kbn:/api/data_views/data-view/bce27b39-28b9-4f9e-ab15-e92e38140949
{
  "data_view": {
   "title": "insight_*"
  }
}

is there is any way to fix this issue.

Hi Nilaksha. You have an extra / between kbn: and api in the POST URL. Try

POST kbn:api/data_views/data-view/bce27b39-28b9-4f9e-ab15-e92e38140949
{
  "data_view": {
   "title": "insight_*"
  }
}

I tried it. but still getting 404 not found

Hi @nilaksha Welcome to the Community!

I just ran this in 8.6.2.

POST kbn:api/data_views/data_view
{
  "data_view": {
     "title": "logstash-*",
     "name": "My Logstash Data View"
  }
}

#results
{
  "data_view": {
    "id": "67b6bac1-e601-48da-9e02-2e5e9fa37eb5",
    "version": "WzU0MCwyXQ==",
    "title": "logstash-*",
    "sourceFilters": [],
    "fields": {},
    "typeMeta": {},
    "fieldFormats": {},
    "runtimeFieldMap": {},
    "fieldAttrs": {},
    "allowNoIndex": false,
    "name": "My Logstash Data View"
  }
}

Then ran the update

POST kbn:/api/data_views/data_view/67b6bac1-e601-48da-9e02-2e5e9fa37eb5
{
  "data_view": {
     "title": "logstash-*",
     "name": "My Logstash Updated Data View"
  }
}

# Results

{
  "data_view": {
    "id": "67b6bac1-e601-48da-9e02-2e5e9fa37eb5",
    "version": "WzU2MCwyXQ==",
    "title": "logstash-*",
    "sourceFilters": [],
    "fields": {},
    "typeMeta": {},
    "fieldFormats": {},
    "runtimeFieldMap": {},
    "fieldAttrs": {},
    "allowNoIndex": false,
    "name": "My Logstash Updated Data View"
  }
}

Please show us the same commands in text with the same sequence.... perhaps you have a cut and paste issue with the ID.

Thank you! this one is worked and I checked the difference of the text in the command. It is a syntax issue with my command.


but i copied it from kibana documentation.

Thanks for the help.

1 Like

Thanks for reporting this. I've added a PR to update the docs. [Docs] Fix curl examples in update data view api docs by nickpeihl · Pull Request #153292 · elastic/kibana · GitHub

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.