# Spark NQL capabilities

Use Nexthink Query Language (NQL) in the [Investigations](/platform/user-guide/investigations/creating-investigations/nql-editor.md) module to access Spark conversations data.

The system stores each conversation in the `agent.conversations` NQL table. Refer to [NQL data model > Namespace agent](/platform/understanding-key-data-platform-concepts/nql-data-model.md#agent) for more details on available fields.

The following are examples of common NQL queries:

<details>

<summary>Key Spark KPIs</summary>

Retrieve key Spark KPIs from the last 30 days, such as the number of active users, total number of conversations and the number of conversations that are currently active.

{% code overflow="wrap" lineNumbers="true" %}

```
agent.conversations during past 30d
| summarize active_users = user.count(), total_conversations = conversation_id.count(), active_conversations = conversation_id.countif((state == in_progress or state == null))
```

{% endcode %}

</details>

<details>

<summary>Conversation number and duration per device</summary>

Retrieve the number of conversations and avarage conversation duration per device.

```
devices during past 30d
| include agent.conversations during past 30d
| where agent.conversations.outcome in [resolved, escalated]
| compute number_of_conversations_ = conversations.number_of_conversations.sum(), average_resolution_time = agent.conversations.conversation_duration.avg()
| where number_of_conversations_ != 0
| where average_resolution_time != 0
| list device.name, device.entity, device.hardware.model, device.hardware.type, device.operating_system.name, number_of_conversations_, average_resolution_time
| sort number_of_conversations_ desc
```

</details>

<details>

<summary>Resolved conversations by resolution reason</summary>

Retrieve the number of resolved conversations in the last 7 days broken down by resolution reason.

{% code overflow="wrap" lineNumbers="true" %}

```
agent.conversations during past 7d
| where outcome == resolved
| summarize number_of_conversations_by_reason = count() by reason
```

{% endcode %}

</details>

RELATED TOPICS

* [Monitoring Spark](/platform/user-guide/spark/monitoring-spark.md)
* [NQL data model](/platform/understanding-key-data-platform-concepts/nql-data-model.md#agent)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/user-guide/spark/spark-nql-capabilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
