# Trying to create role for some applications and got error

**URL:** <https://discuss.elastic.co/t/trying-to-create-role-for-some-applications-and-got-error/279365>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [July 22, 2021, 10:23am UTC](https://discuss.elastic.co/t/trying-to-create-role-for-some-applications-and-got-error/279365 "2021-07-22T10:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gelfandbein](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gelfandbein/32/83636_2.png) [@gelfandbein](https://discuss.elastic.co/u/gelfandbein)\
**Post date:** [July 22, 2021, 10:23am UTC](https://discuss.elastic.co/t/trying-to-create-role-for-some-applications-and-got-error/279365/1 "2021-07-22T10:23:23Z")

</div>

Hello!  
I try to create some basic roles for some application what connecting to ES 6.8.15, but stuck on simple query:  
**curl -XGET [http://localhost:9200/images/\_search](http://localhost:9200/images/_search) -u server:password**

output:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "action [indices:data/read/search[phase/query]] is unauthorized for user [server]"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "images",
        "node" : "-1JT9cU7QjqAZ-B83Iiitg",
        "reason" : {
          "type" : "security_exception",
          "reason" : "action [indices:data/read/search[phase/query]] is unauthorized for user [server]"
        }
      }
    ]
  },
  "status" : 403
}

```

roles.yml:

```auto
application:
  indices:
    - names: ['*']
      privileges: ['all']

```

If I add some cluster privileges to 'all', I got something like:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "security_exception",
        "reason" : "action [indices:data/read/search] is unauthorized for user [server]"
      }
    ],
    "type" : "security_exception",
    "reason" : "action [indices:data/read/search] is unauthorized for user [server]"
  },
  "status" : 403
}

```

& I can't understand WHAT privilege need to add for this query?

---

<div class="post-metadata">

**Author:** ![gelfandbein](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gelfandbein/32/83636_2.png) [@gelfandbein](https://discuss.elastic.co/u/gelfandbein)\
**Post date:** [July 23, 2021, 9:17pm UTC](https://discuss.elastic.co/t/trying-to-create-role-for-some-applications-and-got-error/279365/2 "2021-07-23T21:17:37Z")

</div>

Resolved problem after creating role from `curl X POST...`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 20, 2021, 9:18pm UTC](https://discuss.elastic.co/t/trying-to-create-role-for-some-applications-and-got-error/279365/3 "2021-08-20T21:18:17Z")

</div>

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