---
# System prepended metadata

title: Elasticsearch user&role API
tags: [Elasticsearch]

---

---
title: Elasticsearch user&role API
tags: Elasticsearch
description: View the slide with "Slide Mode".
---

# Elasticsearch user&role API

## Create User
```htmlmixed=
curl -u elastic -X POST "localhost:9200/_security/user/test-user?pretty" -H 'Content-Type: application/json' -d'
{
  "password" : "testpw",
  "roles" : [ "my_test_role"],
  "full_name" : "Jack Nicholson_v222222",
  "email" : "user2@example.com",
  "metadata" : {
    "intelligence" : 7
  }
}
'
```
## Get Users/ Roles
```htmlmixed=
curl -X GET "localhost:9200/_security/role?pretty" -u elastic
curl -X GET "localhost:9200/_security/user?pretty" -u elastic
```
