Skip to main content

SQL Console (Elasticsearch)

This article introduces how to use the SQL Console to manage an Elasticsearch database.

Background Information

Elasticsearch is an open-source distributed search and analytics engine used for fast, scalable, and real-time storage, search, and analysis of large-scale structured and unstructured data.

As a distributed system, Elasticsearch achieves high availability and horizontal scalability by storing data shards on multiple servers. It uses an inverted index data structure to support efficient full-text searching and provides rich querying and analytical capabilities.

NineData's SQL Console supports querying and operating Elasticsearch data sources in a visual and command-based manner, making Elasticsearch management more convenient and intuitive.

Feature Overview

NineData's SQL Console offers several convenient features to help you easily manage your data sources.

Feature
Description
Visual ManagementSupports accessing and viewing Elasticsearch data in a visual way.
EditorProvides a command-line mode supporting powerful Elasticsearch commands and options.
Workspace RecoveryIn scenarios like accidental browser exits or sudden crashes, you can simply log back into the NineData console, open the SQL Console, and the previously opened data sources and executed commands will be automatically loaded. Since the page state is saved in the cloud, it's not restricted by the browser or host, allowing you to recover your workspace anytime, anywhere.
Execution History records all commands executed by the current account in the NineData console, supporting quick retrieval based on data source, execution time, command keywords, and more. You can also quickly copy and re-execute commands from the execution history.

Prerequisites

  • The target database to be managed has been added to NineData. For instructions on how to add, refer to Managing Data Sources.

  • In the organizational mode (), you must have read-only, DML, or DDL permissions for the target data source.

    tip

    Read-only permission supports query operations only.

  • In the commercial versions (, ), please ensure that your monthly/yearly subscription is not expired, as it may result in the inability to use the Database DevOpsservice. You can quickly check the remaining quota and expiration date at the top right corner of the NineData console page.

    check_quota

Operating Steps

  1. Log in to the NineData Console.

  2. Click on and then in the left navigation menu.

    tip

    If you were previously logged into a data source and haven't closed it, you will automatically enter the page for that data source.

  3. Click on the text box below , and your added data sources will pop up. Click on the target data source and then click to go to the SQL Console.

    tip
    • If you haven't created Data Source before, a blank page will be displayed. In this case, please click on on the page.
    • If you have multiple data sources, you can enter all or part of the keywords in the box for precise or fuzzy searching. Supported search fields include:
      • Data source name
      • IP address
  4. After opening the SQL Console, you can perform SQL development operations on the data source. For detailed usage of the SQL Console, please refer to Interface Explanation.

Interface Explanation

es_interface

Number
Feature
Description
1SQL Console TabRepresents the currently opened data source SQL Console. Multiple SQL Consoles can be switched by clicking the tabs, and clicking the X on the right of a tab can close that SQL Console. Right-click menu supports the following actions:
  • : Open the current data source details window.
  • : Open a new data source SQL Console.
  • : Close the current tab.
2Open Data SourceSelect and open a new data source SQL Console.
3Data Source InformationDisplays information about the current SQL Console's data source, including environment, IP address, and port number.
Right-click menu:
  • : Display detailed information about the current data source, including username, connection address, runtime, and number of connections.
  • : Refresh data source information.
4Favorite|Refresh
  • Favorite: Clicking the favorite icon adds the current data source to , allowing for quick selection in a new SQL Console after addition.
  • Refresh: Refresh the data in the current data source.
5Function Buttons
  • execute: Executes the selected Elasticsearch commands.
  • collect: : Save all SQL statements in the current SQL Console to the SQL list for easy access next time.
  • sqlfile: : View saved SQL statements. You can insert the target SQL into the current SQL Console. Additionally, you can or the target SQL.
  • time: : View the execution history of SQL on the target data source. You can choose to filter out the execution history of a certain time period or search the execution history by keywords (SQL statement, database name, error message).
  • setting02: Sets the display mode of the result set and the font size of the SQL Console.
    • : Options are or .
      • (default): New result set will overwrite the previous execution result.
      • : Generates a new tab to display the new result set.
    • : Changes the theme of the SQL Console, options are and .
    • : Drag the slider to adjust the font size of commands in the SQL Console, default values are:
      • Windows: 16
      • MacOS: 13
  • admin: | Only can operate. After enabling this mode, all SQL executed in the SQL Console will not be subject to standardization or approval flows and can be executed directly.
  • expend: Displays the SQL Console in full-screen mode (browser size). After going full-screen, clicking compress in the top right corner restores the SQL Console to its original size.
6SearchEnter the index name for quick access to the target index. Supports entering the complete index name for precise search or entering partial characters for fuzzy search.
8Index ListDisplays the indexes in the current Elasticsearch. In the list, you can perform the following operations on indexes:
  • : Right-click on the target index, click , to automatically generate and execute a command to query the target index data.
  • : Right-click on the target index, click , to view detailed information about the index, including its status, Settings (index configuration), Mappings (structure and field properties of the index), Stats (index statistics and metric details), and more.
  • : Right-click on the target index, click , to generate the script command to create the index.
  • : Right-click on any object, click , to open a new SQL Console tab.
  • : Right-click on any object, click , to refresh the index list.
9Command Line WindowWindow for executing Elasticsearch commands. Specific supported commands can be found in the official documentation. The command line window supports the following features:
  • Execute Elasticsearch commands: Supports executing single or multiple commands.
  • Syntax highlighting
  • Right-click menu:
    • : Execute the Elasticsearch command at the cursor position.
    • : Save all SQL statements in the current SQL Console to the SQL list for easy access next time.
    • : View saved SQL statements. You can insert the target SQL into the current SQL Console. Additionally, you can or the target SQL.
    • : View the execution history of SQL on the target data source. You can choose to filter out the execution history of a certain time period or search the execution history by keywords (SQL statement, database name, error message).
    • Common operations: including , , , and .
    • : Select the command at the cursor position.
10Execution Information, Result SetDisplays the execution information of the command and the result set.
  • Execution Information: Includes execution time, executed command, and execution details.
  • Result Set: Displays the returned results of the command in JSON format. Hovering over the tab of the target result set will show the command corresponding to that result set.