Featured resource
Tech Upskilling Playbook 2025
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Learn more
  • Labs icon Lab
  • Cloud
Google Cloud Platform icon
Labs

Configure User Access Control for Elasticsearch

To enforce data confidentiality and maintain user accessibility with Elasticsearch, we need to know how to create custom roles and users. In this hands-on lab, we go through the following tasks on a single-node Elasticsearch cluster, using either Kibana or `curl` on the command line: * Create custom roles * Create users

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Advanced
Duration
Clock icon 2h 0m
Last updated
Clock icon Aug 17, 2025

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create the sample_read Role

    Use the Kibana console tool to execute the following:

    POST _security/role/sample_read
    {
      "indices": [
        {
          "names": [
            "sample-*"
          ],
          "privileges": [
            "read"
          ]
        }
      ]
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_read?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read"]}]}'
    
  2. Challenge

    Create the sample_write Role

    Use the Kibana console tool to execute the following:

    POST _security/role/sample_write
    {
      "indices": [
        {
          "names": [
            "sample-*"
          ],
          "privileges": [
            "read",
            "write"
          ]
        }
      ]
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_write?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","write"]}]}'
    
  3. Challenge

    Create the sample_monitor Role

    Use the Kibana console tool to execute the following:

    POST _security/role/sample_monitor
    {
      "indices": [
        {
          "names": [
            "sample-*"
          ],
          "privileges": [
            "read",
            "monitor"
          ]
        }
      ]
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_monitor?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","monitor"]}]}'
    
  4. Challenge

    Create the john User

    Use the Kibana console tool to execute the following:

    POST _security/user/john
    {
      "roles": [
        "kibana_user",
        "sample_read"
      ],
      "full_name": "John Doe",
      "email": "[email protected]",
      "password": "john_123"
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/john?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_read"],"full_name":"John Doe","email":"[email protected]","password":"john_123"}'
    
  5. Challenge

    Create the jane User

    Use the Kibana console tool to execute the following:

    POST _security/user/jane
    {
      "roles": [
        "kibana_user",
        "sample_write"
      ],
      "full_name": "Jane Doe",
      "email": "[email protected]",
      "password": "jane_456"
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/jane?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_write"],"full_name":"Jane Doe","email":"[email protected]","password":"jane_456"}'
    
  6. Challenge

    Create the noc User

    Use the Kibana console tool to execute the following:

    POST _security/user/noc
    {
      "roles": [
        "kibana_user",
        "sample_monitor",
        "monitoring_user"
      ],
      "full_name": "Network Operations Center",
      "email": "[email protected]",
      "password": "noc_789"
    }
    

    Or, use command-line curl on any one of the nodes via ssh:

    curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/noc?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_monitor","monitoring_user"],"full_name":"Network Operations Center","email":"[email protected]","password":"noc_789"}'
    

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.