How create a role for creating index and ingest on it

Hi;
I want to create a role with these privileges in "Index privileges" section:
[ create_index , create, create_doc, index]

There is a box to select which index the role can have access:

I have some agents with this role which create and add docs to new_index.
I should choose * for index section so agent can create and ingest. in this situation the agent can access to all Indices. But i want agent can create an index and just access to that index, not other indices.

How can I do it?

Step 1: Create the role

PUT /_security/role/reindex_role
{
  "cluster": ["manage"],
  "indices": [
    {
      "names": ["*"],
      "privileges": ["read", "create_index"]
    }
  ]
}

Step 2: Create the user and assign the role

PUT /_security/user/reindex_user
{
  "password" : "dsads$dasdd$",
  "roles" : [ "reindex_role" ],
  "full_name" : "Reindex User",
  "email" : "reindex_user@example.com"
}
1 Like