b'{"error":{"root_cause":[{"type":"parse_exception","reason":"failed to parse role [my_role]. unexpected field [kibana]"}],"type":"parse_exception","reason":"failed to parse role [my_role]. unexpected field [kibana]"},"status":400}'
I got it to work with a few updates. I removed the 'applications' key as it gave me an error, I am not sure what that should correspond to in the API. Then the 'indices' key I moved under 'elasticsearch' key. I updated to use put instead of post, fixed the endpoint, sent the data as JSON, here is the full example below, hope that helps. Thanks.
my python code: req = requests.post('http://node:9200/_security/role/my_role_es', data = my_role_es , headers = ..., auth=HTTPBasicAuth('...', '...'))
It worked fine and seems port on 9200 (elasticsearch) can recognize the field term: "applications", "indices", "cluster", but can't "elasticsearch", "kibana".
However, if I want to add field "elasticsearch", "kibana",
for example:
My post code of python need to toward to 5601(kibana) req = requests.post('http://node:5601/api/security/role/my_role_kibana', data = my_role_kibana , headers = ..., auth=HTTPBasicAuth('...', '...'))
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.