Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/reference/sql/endpoints/cli.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ the first parameter:
$ ./bin/elasticsearch-sql-cli https://some.server:9200
--------------------------------------------------

If security is enabled on your cluster, you can pass the username
and password in the form `username:password@host_name:port`
to the SQL CLI:

[source,bash]
--------------------------------------------------
$ ./bin/elasticsearch-sql-cli https://sql_user:[email protected]:9200
--------------------------------------------------

Once the CLI is running you can use any <<sql-spec,query>> that
Elasticsearch supports:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jline.terminal.TerminalBuilder;
import java.io.IOException;
import java.net.ConnectException;
import java.sql.SQLInvalidAuthorizationSpecException;
import java.util.Arrays;
import java.util.List;
import java.util.logging.LogManager;
Expand Down Expand Up @@ -139,6 +140,10 @@ private void checkConnection(CliSession cliSession, CliTerminal cliTerminal, Con
// Most likely Elasticsearch is not running
throw new UserException(ExitCodes.IO_ERROR,
"Cannot connect to the server " + con.connectionString() + " - " + ex.getCause().getMessage());
} else if (ex.getCause() != null && ex.getCause() instanceof SQLInvalidAuthorizationSpecException) {
throw new UserException(ExitCodes.NOPERM,
"Cannot establish a secure connection to the server " +
con.connectionString() + " - " + ex.getCause().getMessage());
} else {
// Most likely we connected to something other than Elasticsearch
throw new UserException(ExitCodes.DATA_ERROR,
Expand Down