Same index pattern in multiple namespaces

Hi
I am using Kibana/Elasticsearch version 7.16.3. I have trouble creating the same index pattern within multiple namespaces. I am using bulk create API to create multiple index patterns and for one of the patterns which is present in another namespace, I am getting status code 409 with error indicating there is Conflict and the index pattern is not over writable.

  json:
    saved_objects:
    - attributes:
        timeFieldName: '@timestamp'
        title: fi5-dev-*
      coreMigrationVersion: 8.4.2
      id: fi5-dev-pattern
      migrationVersion:
        index-pattern: 8.0.0
      namespaces:
      - fi5-dev-space
      references: []
      type: index-pattern
      updated_at: '2022-10-06T19:41:59.897Z'
      version: WzU0MzAxLDRd
    - error:
        error: Conflict
        message: Saved object [index-pattern/shared-dev-pattern] conflict
        metadata:
          isNotOverwritable: true
        statusCode: 409
      id: shared-dev-pattern
      type: index-pattern

I am calling https://localhost:5601/s/fi5-dev-space/api/saved_objects/_bulk_create to create the index pattern with following attributes

[
  {
    "type": "index-pattern",
    "id": "fi5-dev-index-pattern",
    "attributes": {
      "title": "fi5-dev-*",
      "timeFieldName": "@timestamp",
      "initialNamespaces": "fi5-dev-space"
    }
  },
  {
    "type": "index-pattern",
    "id": "shared-index-pattern",
    "attributes": {
      "title": "shared-dev-*",
      "timeFieldName": "@timestamp",
      "initialNamespaces": "fi5-dev-space"
    }
  }
]

The shared dev index pattern is present in another namespace fi1-dev.

{
  "saved_objects": [
    {
      "id": "shared-dev-pattern",
      "type": "index-pattern",
      "namespaces": [
        "fi1-dev-space"
      ],
      "updated_at": "2022-10-06T21:57:06.387Z",
      "version": "WzU0OTY5LDRd",
      "attributes": {
        "title": "shared-dev-*",
        "timeFieldName": "@timestamp",
        "initialNamespaces": "fi1-dev-space"
      },
      "references": [],
      "migrationVersion": {
        "index-pattern": "8.0.0"
      },
      "coreMigrationVersion": "8.4.2"
    }
  ]
}

Thanks for your time and Any pointers to resolve this is appreciated.

Ids of index-pattern saved objects need to be unique even across spaces. Make sure to use a different id per space.

Alternatively you can create a single index-pattern and list all the spaces you want it to be available in the initialNamespaces property: Create saved objects API | Kibana Guide [master] | Elastic

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