# NQLエディタ

NQLエディターは、Nexthink Query Language（NQL）を使って調査を作成および実行するためのウェブベースのユーザーインターフェースを提供します。

組み込みの構文エディターを使用して、既存のクエリを調整したり、ゼロから新しいクエリを作成することができます。 結果は、組織内の従業員が直面する問題や課題を調査するのに役立ちます。

## NQLエディターを使用したデータクエリ <a href="#nqleditor-accessingthenqleditor" id="nqleditor-accessingthenqleditor"></a>

{% hint style="info" %}
事前に定義された調査を含む[Nexthink Library Investigations starter](https://docs.nexthink.com/platform/ja/library-packs/it-operations/investigations-starter-pack)パックをインストールすると、NQLクエリを手動で記述したり、Nexthink AssistまたはVisualエディタを使用してデータをクエリすることなく、一般的な問題に関する洞察を迅速に得ることができます。
{% endhint %}

1. メインメニューから**調査**を選択して、新規の調査を作成するか、既存の調査を編集します。 [ビジュアルエディター](/platform/ja/user-guide/investigations/creating-investigations/visual-editor.md)のタブがデフォルトで開きます。
   * 必要に応じて、ページの右上隅の**新しい調査**ボタンをクリックして、新しい調査タブを開きます。
2. **NQLエディター**モードに切り替えて、NQLクエリの記述を開始します。
   * NQLの文法および機能に関する詳細については、[Nexthinkクエリ言語 (NQL)](/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql.md) ドキュメントページを参照してください。
   * NQLエディタの右下にあるクエスチョンマークアイコン (**?**)を使用して、[NQLデータモデル](/platform/ja/understanding-key-data-platform-concepts/nql-data-model.md) ドキュメントページにアクセスしてください。

<figure><img src="/files/NtVhNuytpLy1GdfeRNcC" alt="Querying data using the NQL editor."><figcaption></figcaption></figure>

* オートコンプリートの助けを借りてNQLエディタでNQLクエリを記述します。

<figure><img src="/files/kL2q53grybdusHVwgzbD" alt="autocomplete"><figcaption></figcaption></figure>

* あるいは、[Nexthink Assist](https://docs.nexthink.com/platform/ja/user-guide/search-and-nexthink-assist/using-nexthink-assist)のサポートにより、**ビジュアルエディター**やNQLの事前知識なしで調査クエリを構築することができます。

3. クエリを実行して**結果**タブで結果を生成するには、**実行**を選択します。
4. 必要に応じて、**実行**の隣にあるNQLエディターで使用可能なボタンを使用します。
   * **クエリをコピー**
   * **クリップボードから貼り付け**
   * **クエリをクリア**
5. NQLエディタの下端を上下にドラッグして、縦方向のサイズを変更します。 デフォルトのサイズに戻すには、**高さをリセット**をクリックします。

{% hint style="info" %}
NQL クエリの最大長は 16000 文字です。
{% endhint %}

### ネットワークビューのための接続イベントをクエリする <a href="#visualeditor-selectingconnectioneventsfornetworkview" id="visualeditor-selectingconnectioneventsfornetworkview"></a>

調査ページから:

1. **NQLエディター**モードに切り替えます。
2. **ネットワーク**タブを有効にするために、`connection.events`を調査するNQLクエリを**実行**します。
3. ネットワークビュー視覚化のために**ネットワーク**タブを開きます。

`connection.events`クエリの例を以下に示します:

```
connection.events during past 7d
| summarize no_of_binaries = binary.count(), no_of_devices = device.count(), no_of_users = user.count(), no_of_applications = application.application.name.count(), no_of_network_applications = application.network_application.name.count()
| list no_of_binaries, no_of_devices, no_of_users, no_of_applications, no_of_network_applications
```

{% hint style="info" %}
ネットワーク関連の問題を特定し、トラブルシューティングする方法を学ぶために、[ネットワークビュー](/platform/ja/user-guide/network-view.md)ドキュメントを参照してください。
{% endhint %}

### 調査結果のチャート可視化をクエリにかける

調査ページから:

1. **NQLエディター**モードに切り替えます。
2. [折れ線グラフ](https://docs.nexthink.com/platform/ja/user-guide/live-dashboards/widget-types/line-chart)と[棒グラフ](https://docs.nexthink.com/platform/ja/user-guide/live-dashboards/widget-types/bar-chart)に対応したNQL構造のクエリを**実行**します。
3. 調査結果テーブルの右上隅にある**チャートビューボタンへの切替**をクリックして、データを可視化します。

以下の棒グラフクエリ例をご覧ください。

{% hint style="info" %}
NQLエディターで作成したクエリからのチャートは、そのビジュアルエディターによって[サポートされない場合](/platform/ja/user-guide/investigations/creating-investigations/visual-editor.md#visualeditor-visualeditorunsupportednqlstatements)があります。
{% endhint %}

```
devices during past 7d
| summarize no_of_devices = count() by device.hardware.model
| list no_of_devices, device.hardware.model
```

<figure><img src="/files/C9RMQmxjDaY800R2RUDf" alt="Querying bar chat visualization in NQL editor."><figcaption></figcaption></figure>

***

関連トピック

* [ビジュアルエディター](/platform/ja/user-guide/investigations/creating-investigations/visual-editor.md)
* [ロール](https://github.com/nexthink/documentation.online-product-documentation/blob/develop/ja_docs/configuring_nexthink/configuring-your-platform/administration/account-management/roles/README.md)


---

# 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/ja/user-guide/investigations/creating-investigations/nql-editor.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.
