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”?
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....
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.