Elasticsearch ships with a script, named elasticsearch-sql-cli, to run the SQL CLI (command-line interface) in its bin directory. Let's use the Elasticsearch Docker container to run the example. Assume that the container ID is 6b3d0fde663d and issue the command, as described in the following code block, to start a bash shell session in the Docker container:
$docker exec -it elasticsearch /bin/bash
[root@6b3d0fde663d elasticsearch]#
You will get a prompt in response, and now you are working in the Elasticsearch Docker container. Issue the elasticsearch-sql-cli command to run the SQL CLI:
[root@6b3d0fde663d elasticsearch]# bin/elasticsearch-sql-cli
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
When the command line starts, you will see the Elastic Stack icon and a prompt for input, as shown in the following screenshot...