# Change default index pattern with role // Discover feature

**URL:** <https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565>\
**Category:** Security\
**Tags:** configure\
**Created:** [February 18, 2023, 7:10pm UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565 "2023-02-18T19:10:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saidose](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/saidose/32/4196_2.png) [@Saidose](https://forum.opensearch.org/u/Saidose)\
**Post date:** [February 18, 2023, 7:10pm UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/1 "2023-02-18T19:10:30Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
Opensearch 2.4

**Describe the issue** :  
For clearance it’s not an issue of having access to indices, it’s index pattern feature in discover.  
This guy:

 ![photo_2023-02-18_23-08-41](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/c/c718f3e5ee0971e934faa215012fa5be69e969b1.jpeg)  
I have a hefty amount of index patterns in my setup and now I want to separate access to these indices between teams, yet I can’t figure out a way to make it user friendly.  
For example:  
I have default index pattern “all” which gives an error and “index\*” which shows data as expected from given rule  
Can I make it so for certain group index pattern “index\*” will be default and for other groups for example “index2\*” “index3\*” etc. ?  
I figured tenants should have some practical use but i can’t find any infromaton on this issue.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [February 27, 2023, 6:47pm UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/2 "2023-02-27T18:47:10Z")

</div>

@Saidose You need to create separate Tenants where you create desired index patterns. Then assign access to the Tenants with the role.

---

<div class="post-metadata">

**Author:** ![Saidose](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/saidose/32/4196_2.png) [@Saidose](https://forum.opensearch.org/u/Saidose)\
**Post date:** [February 27, 2023, 8:08pm UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/3 "2023-02-27T20:08:37Z")

</div>

@pablo Thanks for you answer and time!  
Can you perhaps give a more detailed description? I have to create index pattern while being logged into desired tenant? How do I do that so it doesn’t have access to all other index patterns?  
However in tenant I’m logged in, I can see index patterns from global tenant even though I’m logged in “example\_tenant”

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [February 27, 2023, 8:28pm UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/4 "2023-02-27T20:28:12Z")

</div>

@Saidose You shouldn’t.  
So, when you select each tenant you’ll always see the index pattern from Global tenant?

When you run the below command in Dev Tool, do you get more than one .kibana index?

Could you share your opensearch\_dashboards.yml and config.yml files?

---

<div class="post-metadata">

**Author:** ![Saidose](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/saidose/32/4196_2.png) [@Saidose](https://forum.opensearch.org/u/Saidose)\
**Post date:** [February 28, 2023, 7:01am UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/5 "2023-02-28T07:01:28Z")

</div>

@pablo Yes, I’ll always see patterns from Global

What command?

This is my setup for dashboards security plugin in config.yml:

server.port: 5601  
server.host: 127.0.0.1  
opensearch.requestHeadersWhitelist: [authorization, securitytenant]  
opensearch\_security.multitenancy.enabled: true  
opensearch\_security.multitenancy.tenants.preferred: [Private, Global]  
opensearch\_security.readonly\_mode.roles: [kibana\_read\_only]

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [February 28, 2023, 8:47am UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/6 "2023-02-28T08:47:29Z")

</div>

@Saidose I forgot to add the command.

```auto
GET _cat/indices 

```

The output you’ve posted is from openseach\_dashboards.yml. Could you also share config.yml? It is located in the OpenSearch node.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [February 28, 2023, 9:03am UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/7 "2023-02-28T09:03:38Z")

</div>

@Saidose Take a look at the documentation.

> **[Multi-tenancy configuration](https://opensearch.org/docs/latest/security/multi-tenancy/multi-tenancy-config/)**
>
> Multi-tenancy configuration

Multitenancy must be enabled in OpenSearch (config.yml) and OpenSeach Dashboards (opensearch\_dashboards.yml).

I’ve reproduced your scenario with multitenancy disabled in config.yml.

---

<div class="post-metadata">

**Author:** ![Saidose](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/saidose/32/4196_2.png) [@Saidose](https://forum.opensearch.org/u/Saidose)\
**Post date:** [February 28, 2023, 9:07am UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/8 "2023-02-28T09:07:39Z")

</div>

@pablo yeah sorry, mistook config.yml for dashboards.yml

The output for the command gives one index:  
green open .opensearch\_dashboards\_1 1 44 6 296.7kb 148.3kb

As for config.yml

```auto
_meta:
  type: "config"
  config_version: 2

config:
  dynamic:    
    authc:
      basic_internal_auth_domain:
        http_enabled: true
        transport_enabled: true
        order: 0
        http_authenticator:
          type: basic
          challenge: false
        authentication_backend:
          type: internal

      ldap:
        http_enabled: true
        transport_enabled: false
        order: 1
        http_authenticator:
          type: basic
          challenge: true
        authentication_backend:
          type: ldap
          config:
            enable_ssl: true
            enable_start_tls: false
            enable_ssl_client_auth: false
            verify_hostnames: false
            pemtrustedcas_filepath: *example*
            hosts:
              - *example*
            bind_dn: *example*
            password: *example*
            users:
              primary-userbase:
                 base: *example*
                 search: *example*
              secondary-userbase:
                 base: *example*
                 search: *example*
            username_attribute: *example*
            connect_timeout: 5000
            response_timeout: 0
    authz:
      ldap:
        http_enabled: true
        transport_enabled: true
        authorization_backend:
          type: ldap
          config:
            enable_ssl: true
            enable_start_tls: false
            enable_ssl_client_auth: false
            verify_hostnames: false
            pemtrustedcas_filepath: *example*
            hosts:
              - *example*
            bind_dn: *example*
            password: *example*
            users:
              primary-userbase:
                 base: *example*
                 search: *example*
              secondary-userbase:
                 base: *example*
                 search: *example*
            username_attribute: *example*
            rolebase: *example*
            rolesearch: *example*
            userroleattribute: null
            userrolename: none
            rolename: *example*
            resolve_nested_roles: true

```

Are you talking about this security config.yaml? I modified it not to include sensitive data

---

<div class="post-metadata">

**Author:** ![Saidose](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/saidose/32/4196_2.png) [@Saidose](https://forum.opensearch.org/u/Saidose)\
**Post date:** [February 28, 2023, 9:12am UTC](https://forum.opensearch.org/t/change-default-index-pattern-with-role-discover-feature/12565/9 "2023-02-28T09:12:52Z")

</div>

I see, I’ll try to include it in config.yaml in test environment and get back to you with results, thank you very much. It seems I’ve missed a crucial detail whilst being in a rush!
