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

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

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-fb0f187ac2c7d836e39e4dfbf413b2f584641c06%2FNQLeditor_01.png?alt=media" alt="Querying data using the NQL editor."><figcaption></figcaption></figure>

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" %}
ネットワーク関連の問題を特定し、トラブルシューティングする方法を学ぶために、[ネットワークビュー](https://docs.nexthink.com/platform/ja/user-guide/network-view)ドキュメントを参照してください。
{% 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エディターで作成したクエリからのチャートは、そのビジュアルエディターによって[サポートされない場合](https://docs.nexthink.com/platform/ja/user-guide/investigations/visual-editor#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="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-d849c13166863183a5ae6fa45b56ba5c466a4c15%2FNQLeditor_02.1.png?alt=media" alt="Querying bar chat visualization in NQL editor."><figcaption></figcaption></figure>

***

関連トピック

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