# Elastic Cloud Export CLI You can use the CLI to issue queries and output results. The following instructions show you how to format the query output results using the CLI. This topic includes: ## TD Query Command Usage To output the result of a single query to Elastic Cloud add the `--result` option to the `td query` command. After the job is finished, the results are written into your database: - Nodes: comma separated list of nodes - Use SSL? whether to use SSL or not - Auth Method: select either Basic or None - Username: Username for basic authentication - Password: Password for above user - Mode: select either insert or replace - Index: the name of index - Type: the name of type - ID: (optional) the name of ID column Example of a TD query command format for Elastic Cloud: ```bash td query --result '{"type":"elasticcloud","mode":"insert","nodes":[{"host":"host","port":port}], "use_ssl":true,"auth_method":"basic","user":"user", "index":"index","index_type":"log","bulk_actions":1000, "bulk_size":5242880,"fill_null_for_empty_column":true, "maximum_retries":7,"maximum_retry_interval_millis":120000}' \ -w -d ivan_test_td \ "SELECT column_name, COUNT(1) FROM table GROUP BY column" ``` ## Scheduled Jobs To create a scheduled query whose output is systematically written to Elastic Cloud add the `--result` option when creating the schedule through `td sched:create` command. Every time the job runs, the results are written into `mytbl`. ```bash $ td result:create mydb elascloud://user:password@host/database $ td sched:create hourly_count_example "0 * * * *" -d testdb "select count(*) from www_access" --result mydb:mytbl ``` ## Result Output URL Format The result output target is represented by URL with the following format: ```json { "type":"elasticcloud", "mode":"mode", "nodes":[ { "host":"host", "port":"port" } ], "auth_method":"none", "index":"index", "index_type":"dump", "bulk_actions":1000, "bulk_size":5242880 } ``` where: - **host** is the host name - **port** is the port number - modes specify append or replace