We have a home grown plugin that collects ES metrics. Things were working fine until our plugin was installed in a cluster with x-pack. We are facing the below exception while collecting node stats
org.elasticsearch.ElasticsearchSecurityException: no indices permissions found
at org.elasticsearch.xpack.core.security.support.Exceptions.authorizationError(Exceptions.java:42) ~[?:?]
at org.elasticsearch.xpack.core.security.authz.accesscontrol.SecurityIndexSearcherWrapper.getIndicesAccessControl(SecurityIndexSearcherWrapper.java:306) ~[?:?]
at org.elasticsearch.xpack.core.security.authz.accesscontrol.SecurityIndexSearcherWrapper.wrap(SecurityIndexSearcherWrapper.java:127) ~[?:?]
at org.elasticsearch.index.shard.IndexSearcherWrapper.wrap(IndexSearcherWrapper.java:76) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.index.shard.IndexShard.acquireSearcher(IndexShard.java:1172) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.index.shard.IndexShard.docStats(IndexShard.java:893) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.action.admin.indices.stats.CommonStats.<init>(CommonStats.java:175) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.indices.IndicesService.indexShardStats(IndicesService.java:330) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.indices.IndicesService.statsByShard(IndicesService.java:300) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.indices.IndicesService.stats(IndicesService.java:291) ~[elasticsearch-6.2.3.jar:6.2.3]
at org.elasticsearch.node.NodeService.stats(NodeService.java:112) ~[elasticsearch-6.2.3.jar:6.2.3]
at com.paypal.elasticsearch.sherlock.service.SherlockStats$1.run(SherlockStats.java:90) ~[sherlock-plugin-6.2.3.jar:?]
at com.paypal.elasticsearch.sherlock.service.SherlockStats$1.run(SherlockStats.java:87) ~[sherlock-plugin-6.2.3.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_131]
at com.paypal.elasticsearch.sherlock.service.SherlockStats.publishNodeStats(SherlockStats.java:87) ~[sherlock-plugin-6.2.3.jar:?]
at com.paypal.elasticsearch.sherlock.service.SherlockPublisher.publishStats(SherlockPublisher.java:85) ~[sherlock-plugin-6.2.3.jar:?]
at com.paypal.elasticsearch.sherlock.service.SherlockServiceInitializer$MetricPublisher.run(SherlockServiceInitializer.java:103) [sherlock-plugin-6.2.3.jar:?]
at java.util.TimerThread.mainLoop(Timer.java:555) [?:1.8.0_131]
at java.util.TimerThread.run(Timer.java:505) [?:1.8.0_131]