Kibana api data view NOT working as expected with namespaces parameter

Dear All, my goal is to create kibana data_views using the API;

It works fine if I create simple data_view in the default space.

But it's not working if I want to precise the namespace I want to target.

Looking in the already opened topics, I saw the related topics : Kibana dataview namespace is closed BUT I don't see the solution.
The related github issue is closed as well BUT if I'm not wrong there is so solution displayed.

Obviously there is something wrong with this APIs usage; Is the function won't be implemented ?

If I'm using the api wrong, may I kindly ask me to point me to the good direction ? Thanks.

Could you provide me an update status on this ? Thanks in advance.

kr,

ps: In order to reproduce the issue, here is my dev console output

POST kbn:/api/data_views/data_view
{
 "data_view": {
    "title": "logstash-*",
    "name": "logstash*"
  }
}
  • answer
{
  "data_view": {
    "id": "bc7fbbc3-4af2-40c8-8ac1-9692f4e8b130",
    "title": "logstash-*",
    . . .
    "name": "logstash*"
  }
}
  • delete and recreate specifying the namespaces list this time:
DELETE kbn:/api/data_views/data_view/bc7fbbc3-4af2-40c8-8ac1-9692f4e8b130
POST kbn:/api/data_views/data_view
{
 "data_view": {
    "title": "logstash-*",
    "name": "logstash*",
    "namespaces": ["test", "default"]
  }
}
  • answer:
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "[request body.data_view.namespaces]: definition for this key is missing"
}

Hi @Gautier_Franchini. It looks like we need to fix the documentation. The namespaces parameter does not appear to be supported by the Create data view API. I've reached out to the team to see if we can either add support for namespaces or fix the documentation.

Thank your for you reply; In a "cicd" approach, I think that having this feature available for this API could be really appreciated. The data view API coupled with the space API, this will allow to have more control as well as a more efficient management of spaces and its available features, especially in a "large" company.

But it's just my personal point of view, of courses.

Please, keep me informed.

Thanks again for your time.

kr,

Maybe using a header in the post command could help as well; having something like this:

curl -u kbn-api-user -k -XPOST <https://$(hostname):5601/api/spaces/space> -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -H "es-space-2use: mysupersapcenamehere" -d'
{
  "id": "myaspace",
  "name": "MYSPAPCE",
  "description": "MYSPACE is dedicated space for data analyst",
  "initials": "ME",
  "color": "#E7664C",
  "disabledFeatures": [
    "enterpriseSearch",
    "fleetv2",
    "fleet",
    "ml"
  ],
  "imageUrl": ""
}'

what do you think ?

Hi @Gautier_Franchini. Thanks for adding your thoughts. I don't work directly on the data-views or spaces APIs, so I don't really have an opinion on the best way to implement this. But I've reached out to the appropriate team to triage this. The best place to follow the work on this or make suggestions is in [Data Views] Align the `namespace` parameter with the documentation · Issue #140426 · elastic/kibana · GitHub.

1 Like

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