Tenant saved objects .kibana index

Is there any way to get the tenants .kibana index pattern (the index where Kibana saved objects are stored) upon tenant creation or any other method?
It seems to be constructed like this .kibana_-{unknow_id}_{user_name} but the documentation doesn’t mention it?

here it’s mentioned :
https://opendistro.github.io/for-elasticsearch-docs/docs/security-access-control/multi-tenancy/

Manage Kibana indices

The open source version of Kibana saves all objects to a single index: .kibana . The Security plugin uses this index for the global tenant, but separate indices for every other tenant. Each user also has a private tenant, so you might see a large number of indices that follow two patterns:

.kibana_<hash>_<tenant_name>
.kibana_<hash>_<username>

The Security plugin scrubs these index names of special characters, so they might not be a perfect match of tenant names and usernames.

To back up your Kibana data, take a snapshot of all tenant indices using an index pattern such as .kibana* .

Thank you, I’ve found it myself but still can’t find what is the hash and how it’s generated?

1 Like

It’s is some random unique number or we can say unique identifier for each tenants and users.

Maybe the hash is generated from java.lang.String#hashCode().

Here is a simple JavaScript online implementation which can get you the hash: String.hashCode - JSFiddle - Code Playground

1 Like

thanks, it’s randomly working…
A non working example is the string: “admintenant” which yields 444134585 whereas Kibana computes -152937574
The index is “.kibana_-152937574_admintenant”
Any idea how to get it right?

It’s working…
In the repository opensearch security we have security/TenantInfoAction.java at main · opensearch-project/security · GitHub
this cuts off the extra characters.

You are converting “admintenant”, but in fact the tenant name is " admin_tenant"

admintenant → 444134585
admin_tenant → -152937574