Not able to update security index settings

Hello all,
I am using elasticsearch version 8.9.0. i want to configure security index to have replica on every node.
I am using kibana console for running below command

PUT /_security/settings
{
    "security": {
        "index.auto_expand_replicas": "0-all"
    },
    "security-profile": {
        "index.auto_expand_replicas": "0-all"
    }
}

for above command i am getting error

{
  "error": "Incorrect HTTP method for uri [/_security/settings?pretty=true] and method [PUT], allowed: [POST]",
  "status": 405
}

when i changed method from PUT to POST
it is giving below error

{
  "error": "no handler found for uri [/_security/settings?pretty=true] and method [POST]"
}

but the same command with PUT method executed successfully on another cluster having version 8.12.0.
Can someone please help me with this.

Hello @kuldeep_gupta

I tried to execute the below & did not receive any error on 9.0.3

PUT /_security/settings
{
    "security": {
        "index.auto_expand_replicas": "0-all"
    },
    "security-profile": {
        "index.auto_expand_replicas": "0-all"
    }
}

Could you please try to fetch current settings :

GET /_security/settings

Thanks!!

{
  "error": "Incorrect HTTP method for uri [/_security/settings?pretty=true] and method [GET], allowed: [POST]",
  "status": 405
}
1 Like

Hello @kuldeep_gupta

As per the documentation , could you please check below point for your user -

### Required authorization
Cluster privileges: `read_security`

Thanks!!

{
  "cluster": [
    "all"
  ],
  "global": [],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "allow_restricted_indices": false
    },
    {
      "names": [
        "*"
      ],
      "privileges": [
        "monitor",
        "read",
        "read_cross_cluster",
        "view_index_metadata"
      ],
      "allow_restricted_indices": true
    }
  ],
  "applications": [
    {
      "application": "*",
      "privileges": [
        "*"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [
    "*"
  ]
}

above is the output of below command

GET /_security/user/_privileges

note that i am using elastic user in kibana.

I believe that API was added in 8.10 per Add an API for managing the settings of Security system indices by gwbrown · Pull Request #97630 · elastic/elasticsearch · GitHub, which I see in the 8.10.0 release notes

Thank you mam for response,
Is there any way i can achieve this in version 8.9?

My area of expertise is the Elastic documentation, so beyond the information that's available in Productize a way to change index.auto_expand_replicas and index.number_of_replicas settings on the .security index · Issue #92992 · elastic/elasticsearch · GitHub, I can only offer that per API convention docs "Direct access to system indices is deprecated and will no longer be allowed in a future major version." Thus even if you managed to edit the index settings on the individual security system indices (e.g. via the update index settings API or the Index Management app), the recommended long-term solution would be to use the APIs that were added in 8.10.

No.

Also, 8.9 is very old (it was released 2 years ago), so you should try to schedule an upgrade.