{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Elastic Cloud Export CLI","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"elastic-cloud-export-cli","__idx":0},"children":["Elastic Cloud Export CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This topic includes:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"td-query-command-usage","__idx":1},"children":["TD Query Command Usage"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To output the result of a single query to Elastic Cloud add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--result"]}," option to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td query"]}," command. After the job is finished, the results are written into your database:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Nodes: comma separated list of nodes"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use SSL? whether to use SSL or not"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Auth Method: select either Basic or None"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Username: Username for basic authentication"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Password: Password for above user"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Mode: select either insert or replace"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Index: the name of index"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Type: the name of type"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["ID: (optional) the name of ID column"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example of a TD query command format for Elastic Cloud:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td query --result '{\"type\":\"elasticcloud\",\"mode\":\"insert\",\"nodes\":[{\"host\":\"host\",\"port\":port}],\n\"use_ssl\":true,\"auth_method\":\"basic\",\"user\":\"user\",\n\"index\":\"index\",\"index_type\":\"log\",\"bulk_actions\":1000,\n\"bulk_size\":5242880,\"fill_null_for_empty_column\":true,\n\"maximum_retries\":7,\"maximum_retry_interval_millis\":120000}' \\\n-w -d ivan_test_td \\\n\"SELECT column_name, COUNT(1) FROM table GROUP BY column\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"scheduled-jobs","__idx":2},"children":["Scheduled Jobs"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To create a scheduled query whose output is systematically written to Elastic Cloud add the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--result"]}," option when creating the schedule through ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td sched:create"]}," command. Every time the job runs, the results are written into ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mytbl"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td result:create mydb elascloud://user:password@host/database\n$ td sched:create hourly_count_example \"0 * * * *\" -d testdb \"select count(*) from www_access\" --result mydb:mytbl\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"result-output-url-format","__idx":3},"children":["Result Output URL Format"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The result output target is represented by URL with the following format:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n   \"type\":\"elasticcloud\",\n   \"mode\":\"mode\",\n   \"nodes\":[\n      {\n         \"host\":\"host\",\n         \"port\":\"port\"\n      }\n   ],\n   \"auth_method\":\"none\",\n   \"index\":\"index\",\n   \"index_type\":\"dump\",\n   \"bulk_actions\":1000,\n   \"bulk_size\":5242880\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["where:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["host"]}," is the host name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["port"]}," is the port number"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["modes specify append or replace"]}]}]},"headings":[{"value":"Elastic Cloud Export CLI","id":"elastic-cloud-export-cli","depth":1},{"value":"TD Query Command Usage","id":"td-query-command-usage","depth":2},{"value":"Scheduled Jobs","id":"scheduled-jobs","depth":2},{"value":"Result Output URL Format","id":"result-output-url-format","depth":2}],"frontmatter":{"seo":{"title":"Elastic Cloud Export CLI"}},"lastModified":"2025-11-07T02:49:55.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/elastic-cloud-export-cli","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}