How to avoid error of "no permission" when searching using an index pattern?

Greetings everyone,

I have a case where I created two indices (index1, and index2). I have two groups of users added to two roles (role1, role2) which are assigned to index1 and index2 indices respectively with search permissions.

Now I have one application querying all data in elasticsearch using the pattern index*. However, users get “no permission” error when running search because users in either roles don’t have search permission over one of the indices.

The user expected behaviour is that Elasticsearch will return results from the index the user has access to. How can I get that behaviour done?

Thanks

You need to give application user index* permission if you query via pattern index*

@asfoorial there is an option in config.yml file that needs to be enabled, I think this will give you the functionality you are looking for:

config:
  dynamic:
     do_not_fail_on_forbidden: true

Please remember to upload the config with securityadmin.sh script and admin cert:

./securityadmin.sh -cd .../securityconfig/ -icl -nhnv -cacert .../root-ca.pem -cert .../kirk.pem -key .../kirk-key.pem

Thanks @Anthony and I will give it a try and see the behavior