# Can't create API role for Gitlab Advanced Search

**URL:** <https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [September 29, 2023, 11:20am UTC](https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131 "2023-09-29T11:20:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oscar\_Yerpes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oscar_yerpes/32/126115_2.png) [@Oscar\_Yerpes](https://discuss.elastic.co/u/Oscar_Yerpes)\
**Post date:** [September 29, 2023, 11:20am UTC](https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131/1 "2023-09-29T11:20:25Z")

</div>

Hi all,

As a part of enabling Gitlab Advanced Search using Elastic as a backend, I need to create a role in Elastic.

Elastic API returns this error message when doing GET or POST actions:

```auto
GET _security/role
{
  "error" : "Incorrect HTTP method for uri [/_security/role?pretty=true] and method [GET], allowed: [POST]",
  "status" : 405
}

```

```auto
POST _security/role/gitlab-role
{
  "cluster": ["mm-elk"],
  "indices": [
    {
      "names": ["gitlab-*"],
      "privileges": [
        "create_index",
        "delete_index",
        "view_index_metadata",
        "read",
        "manage",
        "write"
      ]
    }
  ]
}

```

This returns:

```auto
{
  "error" : "no handler found for uri [/_security/role/gitlab-role?pretty=true] and method [POST]"
}

```

Version is 8.1.2.

Any ideas on what might I be missing?

Thanks!

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [September 30, 2023, 10:04am UTC](https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131/2 "2023-09-30T10:04:45Z")

</div>

It looks like security is disabled on your cluster.

Check for `xpack.security.enabled` in your `elasticsearch.yml`

---

<div class="post-metadata">

**Author:** ![Oscar\_Yerpes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oscar_yerpes/32/126115_2.png) [@Oscar\_Yerpes](https://discuss.elastic.co/u/Oscar_Yerpes)\
**Post date:** [October 3, 2023, 5:42am UTC](https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131/3 "2023-10-03T05:42:54Z")

</div>

Thanks Tim,

Indeed, right now xpack.security is disabled. Do I also need to enable anonymous access for this gitlab advanced search?

> **[Enabling anonymous access | Elasticsearch Guide \[8.1\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.1/anonymous-access.html)**

And add the gitlab\_role there?

Best regards,  
Oscar

---

<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:** [October 31, 2023, 5:43am UTC](https://discuss.elastic.co/t/cant-create-api-role-for-gitlab-advanced-search/344131/4 "2023-10-31T05:43:16Z")

</div>

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