ES 8.19.5 encountered a NotEntitledException when attach to the ES process using Arthas

elasticsearch8.19.5 use Entitlements module,Arthas fails to attach.

Entitlement Policy Configuration (arthas-entitlement-policy.yaml):

versions:
  8.19.5
policy:
  ALL-UNNAMED:
    file:
      read:
        paths:
          - /usr/share/elasticsearch/logs/arthas
          - /usr/share/elasticsearch/logs/arthas/**  
          - /usr/share/elasticsearch/.arthas/**      
          - /usr/share/elasticsearch/.arthas
          - /usr/share/elasticsearch/.arthas/arthas-core.jar

Startup Command:
Elasticsearch was launched with the parameter:
-Des.entitlements.policy.arthas=/usr/share/elasticsearch/config/arthas-entitlement-policy.yaml

Error Message:
Not entitled: component [(unknown)], module [ALL-UNNAMED], class [class com.taobao.arthas.agent334.AgentBootstrap], entitlement [file], operation [read], path [/usr/share/elasticsearch/.arthas/arthas-core.jar]

How can I resolve this issue? ~~~

Or is it possible to disable Entitlements detection? I tried -Des.entitlements.enabled=false but it didn't work.

We don't support attaching agents to Elasticsearch.

My guess is that you won't be able to get this to work without modifying Elasticsearch itself.

Note the warning here:

Don’t use third-party Java agents that attach to the JVM. Such agents can be harmful to Elasticsearch stability and performance. In some cases they may cause nodes to freeze, crash, or fail to start up, or to lose or corrupt your data.