Failed to index documents in 'traces-apm-default' (security_exception): action [indices:data/write/bulk[s]]

Hello everyone,

I encountered the following error, but it seems like the permissions are properly set up. I'm not sure what the issue might be. If there's any additional information needed, please let me know.

Thank you in advance for your assistance!

Best regards

{"log.level":"error","@timestamp":"2024-04-23T12:50:51.497Z","log.origin":{"function":"github.com/elastic/go-docappender.(*Appender).flush","file.name":"go-docappender@v1.0.0/appender.go","file.line":369},"message":"failed to index documents in 'traces-apm-default' (security_exception): action [indices:data/write/bulk[s]] is unauthorized for user [apm_system_authorized] with effective roles [apm_role] on indices [traces-apm-default], this action is granted by the index privileges [create_doc,create,delete,index,write,all]","service.name":"apm-server","documents":2,"ecs.version":"1.6.0"}

"GET /_security/user/apm_system_authorized" in dev tools
{
  "apm_system_authorized": {
    "username": "apm_system_authorized",
    "roles": [
      "apm_role"
    ],
    "full_name": null,
    "email": null,
    "metadata": {},
    "enabled": true
  }
}
"GET /_security/role/apm_role" in dev tools
{
  "apm_role": {
    "cluster": [
      "cluster:admin/xpack/monitoring/bulk",
      "monitor"
    ],
    "indices": [
      {
        "names": [
          "apm-*",
          "new-index-*",
          "metrics-*",
          "traces-apm*,traces-apm-default,apm-*,logs-apm*,apm-*,metrics-apm*,apm-*",
          "logs-*"
        ],
        "privileges": [
          "read",
          "write",
          "create_index",
          "create_doc",
          "create",
          "delete",
          "index",
          "all"
        ],
        "allow_restricted_indices": false
      }
    ],
    "applications": [],
    "run_as": [
      "apm_system_authorized"
    ],
    "metadata": {},
    "transient_metadata": {
      "enabled": true
    }
  }
}