How to get and create users in elasticsearch with API by using python

I want to get and create users in elasticsearch with python. I'm trying to use API. I'm following this documentation. I send a get request with Postman in this URL:

http://localhost:9200/_opendistro/_security/api/internalusers/

I send this request for getting users but I got this error message:

{
    "error": "no handler found for uri [/opendistro/security/api/internalusers] and method [GET]"
}

I also want to create a user with username and email but here I found this for creating user:

{
  "password": "kirkpass",
  "backend_roles": ["captains", "starfleet"],
  "attributes": {
    "attribute1": "value1",
    "attribute2": "value2"
  }
}

There are no options for username and password

my two questions are:

  1. Why I'm getting an error when I try to get users?
  2. How can I create users with username and email by using an API

Hi,

Do you have an openDistro installation? In this case you should ask here: https://discuss.opendistrocommunity.dev/

Be aware that openDistro of ElasticSearch is not the same as the one available by elastic. If you have an Elastic Installation you can check the API here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-user.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html

This requires that you have at least the ElasticSearch Basic License(when using 6.8.0 or later or 7.1.0 or later) or a Gold License.

Best regards
Wolfram

1 Like

Thanks. I got my mistake. I thought openDistro is an inbuilt plugin of elasticsearch. Now, I'll install it.

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