> For the complete documentation index, see [llms.txt](https://documentation.ardoq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ardoq.com/advanced-features/gremlin-graph-search.md).

# Gremlin Graph Search

Graph Search is a powerful way of analyzing your data and building up an Enterprise Intelligence Graph.

When you are putting data into Ardoq you are essentially building up an Enterprise Intelligence Graph. This provides an always up-to-date Digital Twin of all data, processes, and their relationships, meaning you can ask the system about all parts of your documentation.

We use the graph traversal language [Gremlin](http://tinkerpop.apache.org/docs/current/tutorials/getting-started/) to write queries in Ardoq. This helps you navigate the vertices and edges of your Enterprise Intelligence Graph.

## Before Getting Started <a href="#h_4c3ad5670d" id="h_4c3ad5670d"></a>

To create Gremlin queries, you must have the **Create Gremlin** privilege enabled. This privilege can be assigned to an entire user role or granted individually per user.

{% hint style="info" %}
**Important**: The Gremlin privilege permits Writer users to view data in the entire graph, ignoring existing workspace permissions. It should ONLY be enabled for users with high trust. For example, users who might have otherwise had the Admin role but who can now accomplish their responsibilities as Writers with Gremlin access.
{% endhint %}

## How to Allow Users to Create Gremlin Queries <a href="#h_3fa9f4c0a4" id="h_3fa9f4c0a4"></a>

If you are an admin user in Ardoq, you can allow users to create Gremlin queries by enabling the **Create Gremlin** privilege. This can be configured either across an entire user role or individually per user.

### Enabling Gremlin Privileges on a User Role <a href="#h_f7c0def9b8" id="h_f7c0def9b8"></a>

To allow all users with a specific role to create Gremlin queries:

{% stepper %}
{% step %}

### Navigate to User Roles

Click the organization menu in the top-left corner and select **Admin** > **Access Control** and select the **Roles** ta&#x62;**.**
{% endstep %}

{% step %}

### Select Role

Select the user role you want to configure with Gremlin privileges.
{% endstep %}

{% step %}

### Enable Gremlin

Check the **Create Gremlin** box and click **Save changes**.

<figure><img src="https://2484004798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnlnB7uZ29iLVLzqGbCym%2Fuploads%2FkGnYMdjjBzy5fwAxPjhF%2Fimage.png?alt=media&amp;token=803937d8-f658-48bb-aa46-4ea9638be473" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Enabling the Create Gremlin privilege on a user role is the most efficient way to manage query-creation permissions across your organization. Once this privilege is enabled for a specific user role, it cannot be disabled for individual users assigned to that role.

For example, if you enable the Create Gremlin privilege on the Writer user role, all current and future Writer users will automatically have the permission to create Gremlin queries. Because this permission is applied at the role level, you will not be able to revoke the Create Gremlin privilege from individual users who hold the Writer role.

### Enabling Gremlin Privileges for a Single User <a href="#h_1ad6608f5a" id="h_1ad6608f5a"></a>

Enable the Create Gremlin privilege for individual users when specific team members need query creation access, but their assigned user role does not include it.

To enable the Create Gremlin privilege for an individual user:

{% stepper %}
{% step %}

### Navigate to Users

Click the organization menu in the top-left corner and select **Admin** > **Access Control** > and select the **Users** tab.
{% endstep %}

{% step %}

### Select a User

Find the specific user you want to modify and click the three-dot icon next to their name and select **Assign Privileges**.
{% endstep %}

{% step %}

### Enable Gremlin

In the privileges modal, select the **Create Gremlin** privilege from the dropdown menu and then click **Assign privileges**.
{% endstep %}
{% endstepper %}

## Create a Gremlin Query <a href="#h_e5d9b3af6b" id="h_e5d9b3af6b"></a>

You can query your data with Gremlin from the **Reports** page:

1. Navigate to Reports from the main menu.
2. In the top-right corner, click the **Advanced** button and select **Gremlin graph search**
3. Enter your Gremlin query and click **Search**

### **Sample Query**

The following query will look for all components (vertices in Gremlin terms) with the label (component type) `Person` that have a field called `name`.

```
g.V().hasLabel('Person').values('name')
```

The following example demonstrates how to identify which applications will be impacted if a specific server fails.

```
g.V().
 has('name', 'mongodb-1').
 both().
 hasLabel('Application').
 dedup()
```

## FAQ <a href="#h_9cf2f9f003" id="h_9cf2f9f003"></a>

**Where can I learn more about Gremlin?**

For deeper documentation of the Gremlin query language, please refer to the official [Tinkerpop documentation](https://tinkerpop.apache.org/docs/3.6.5/recipes/).

**How do I refer to Ardoq-specific fields using Gremlin?**

Refer to the list of Ardoq reserved fields below and their Gremlin-equivalent name:

<table><thead><tr><th width="379">Reserved Field</th><th>Gremlin Name</th></tr></thead><tbody><tr><td>Ardoq OID</td><td>id()</td></tr><tr><td>Ardoq ID</td><td>component-key</td></tr><tr><td>Created at</td><td>created</td></tr><tr><td>Updated at</td><td>last-updated</td></tr><tr><td>Created by</td><td>createdByName</td></tr><tr><td>Last Updated By</td><td>lastModifiedByName</td></tr><tr><td>Created by (Email)</td><td>createdByEmail</td></tr><tr><td>Last Updated By (Email)</td><td>lastModifiedByEmail</td></tr><tr><td>Workspace ID</td><td>rootWorkspace</td></tr><tr><td>Type</td><td>label()</td></tr></tbody></table>

**Can Gremlin be used to retrieve a count for the number of Broadcasts/Surveys for a given component?**

No, it is currently not possible to use Gremlin to retrieve a count of the number of broadcasts or surveys that have been sent for a given component.
