Want to check check if Elastic search “read_only_allow_delete” is true

Elastic 6.8 I want to write something (Python) that check if the “read_only_allow_delete” is true, and if it’s true to do something(notify) Is it possible to write something that run all the indices and check the status of “read_only_allow_delete”?

Thanks !

I found some old code from something I was testing, it's based on the Python API

Code:

indices = es.indices.get(index="*")
for k, v in sorted(indices.items()):
     if k == "_all":
          continue
     if k.startswith( "." ):
          continue
     print(k)
     pprint.pprint(v["aliases"])
     pprint.pprint(v["settings"])
     break

If I remember correctly, this gets a GET index/_settings on all indices in the cluster. If v["settings"] ["index"]["blocks"] exists ["read_only"] would be true.

Do a GET _settings on your index with the block to verify the keys, this is from memory....

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.