SQL-based ingestion API

SQL-based ingestion - 图1info

This page describes SQL-based batch ingestion using the druid-multi-stage-query extension, new in Druid 24.0. Refer to the ingestion methods table to determine which ingestion method is right for you.

The Query view in the web console provides a friendly experience for the multi-stage query task engine (MSQ task engine) and multi-stage query architecture. We recommend using the web console if you do not need a programmatic interface.

When using the API for the MSQ task engine, the action you want to take determines the endpoint you use:

  • /druid/v2/sql/task endpoint: Submit a query for ingestion.
  • /druid/indexer/v1/task endpoint: Interact with a query, including getting its status, getting its details, or canceling it. This page describes a few of the Overlord Task APIs that you can use with the MSQ task engine. For information about Druid APIs, see the API reference for Druid.

Submit a query

You submit queries to the MSQ task engine using the POST /druid/v2/sql/task/ endpoint.

Request

The SQL task endpoint accepts SQL requests in the JSON-over-HTTP form using the query, context, and parameters fields, but ignoring the resultFormat, header, typesHeader, and sqlTypesHeader fields.

This endpoint accepts INSERT and REPLACE statements.

As an experimental feature, this endpoint also accepts SELECT queries. SELECT query results are collected from workers by the controller, and written into the task report as an array of arrays. The behavior and result format of plain SELECT queries (without INSERT or REPLACE) is subject to change.

  • HTTP
  • curl
  • Python
  1. POST /druid/v2/sql/task
  1. {
  2. "query": "INSERT INTO wikipedia\nSELECT\n TIME_PARSE(\"timestamp\") AS __time,\n *\nFROM TABLE(\n EXTERN(\n '{\"type\": \"http\", \"uris\": [\"https://druid.apache.org/data/wikipedia.json.gz\"]}',\n '{\"type\": \"json\"}',\n '[{\"name\": \"added\", \"type\": \"long\"}, {\"name\": \"channel\", \"type\": \"string\"}, {\"name\": \"cityName\", \"type\": \"string\"}, {\"name\": \"comment\", \"type\": \"string\"}, {\"name\": \"commentLength\", \"type\": \"long\"}, {\"name\": \"countryIsoCode\", \"type\": \"string\"}, {\"name\": \"countryName\", \"type\": \"string\"}, {\"name\": \"deleted\", \"type\": \"long\"}, {\"name\": \"delta\", \"type\": \"long\"}, {\"name\": \"deltaBucket\", \"type\": \"string\"}, {\"name\": \"diffUrl\", \"type\": \"string\"}, {\"name\": \"flags\", \"type\": \"string\"}, {\"name\": \"isAnonymous\", \"type\": \"string\"}, {\"name\": \"isMinor\", \"type\": \"string\"}, {\"name\": \"isNew\", \"type\": \"string\"}, {\"name\": \"isRobot\", \"type\": \"string\"}, {\"name\": \"isUnpatrolled\", \"type\": \"string\"}, {\"name\": \"metroCode\", \"type\": \"string\"}, {\"name\": \"namespace\", \"type\": \"string\"}, {\"name\": \"page\", \"type\": \"string\"}, {\"name\": \"regionIsoCode\", \"type\": \"string\"}, {\"name\": \"regionName\", \"type\": \"string\"}, {\"name\": \"timestamp\", \"type\": \"string\"}, {\"name\": \"user\", \"type\": \"string\"}]'\n )\n)\nPARTITIONED BY DAY",
  3. "context": {
  4. "maxNumTasks": 3
  5. }
  6. }
  1. # Make sure you replace `username`, `password`, `your-instance`, and `port` with the values for your deployment.
  2. curl --location --request POST 'https://<username>:<password>@<your-instance>:<port>/druid/v2/sql/task/' \
  3. --header 'Content-Type: application/json' \
  4. --data-raw '{
  5. "query": "INSERT INTO wikipedia\nSELECT\n TIME_PARSE(\"timestamp\") AS __time,\n *\nFROM TABLE(\n EXTERN(\n '\''{\"type\": \"http\", \"uris\": [\"https://druid.apache.org/data/wikipedia.json.gz\"]}'\'',\n '\''{\"type\": \"json\"}'\'',\n '\''[{\"name\": \"added\", \"type\": \"long\"}, {\"name\": \"channel\", \"type\": \"string\"}, {\"name\": \"cityName\", \"type\": \"string\"}, {\"name\": \"comment\", \"type\": \"string\"}, {\"name\": \"commentLength\", \"type\": \"long\"}, {\"name\": \"countryIsoCode\", \"type\": \"string\"}, {\"name\": \"countryName\", \"type\": \"string\"}, {\"name\": \"deleted\", \"type\": \"long\"}, {\"name\": \"delta\", \"type\": \"long\"}, {\"name\": \"deltaBucket\", \"type\": \"string\"}, {\"name\": \"diffUrl\", \"type\": \"string\"}, {\"name\": \"flags\", \"type\": \"string\"}, {\"name\": \"isAnonymous\", \"type\": \"string\"}, {\"name\": \"isMinor\", \"type\": \"string\"}, {\"name\": \"isNew\", \"type\": \"string\"}, {\"name\": \"isRobot\", \"type\": \"string\"}, {\"name\": \"isUnpatrolled\", \"type\": \"string\"}, {\"name\": \"metroCode\", \"type\": \"string\"}, {\"name\": \"namespace\", \"type\": \"string\"}, {\"name\": \"page\", \"type\": \"string\"}, {\"name\": \"regionIsoCode\", \"type\": \"string\"}, {\"name\": \"regionName\", \"type\": \"string\"}, {\"name\": \"timestamp\", \"type\": \"string\"}, {\"name\": \"user\", \"type\": \"string\"}]'\''\n )\n)\nPARTITIONED BY DAY",
  6. "context": {
  7. "maxNumTasks": 3
  8. }
  9. }'
  1. import json
  2. import requests
  3. # Make sure you replace `your-instance`, and `port` with the values for your deployment.
  4. url = "https://<your-instance>:<port>/druid/v2/sql/task/"
  5. payload = json.dumps({
  6. "query": "INSERT INTO wikipedia\nSELECT\n TIME_PARSE(\"timestamp\") AS __time,\n *\nFROM TABLE(\n EXTERN(\n '{\"type\": \"http\", \"uris\": [\"https://druid.apache.org/data/wikipedia.json.gz\"]}',\n '{\"type\": \"json\"}',\n '[{\"name\": \"added\", \"type\": \"long\"}, {\"name\": \"channel\", \"type\": \"string\"}, {\"name\": \"cityName\", \"type\": \"string\"}, {\"name\": \"comment\", \"type\": \"string\"}, {\"name\": \"commentLength\", \"type\": \"long\"}, {\"name\": \"countryIsoCode\", \"type\": \"string\"}, {\"name\": \"countryName\", \"type\": \"string\"}, {\"name\": \"deleted\", \"type\": \"long\"}, {\"name\": \"delta\", \"type\": \"long\"}, {\"name\": \"deltaBucket\", \"type\": \"string\"}, {\"name\": \"diffUrl\", \"type\": \"string\"}, {\"name\": \"flags\", \"type\": \"string\"}, {\"name\": \"isAnonymous\", \"type\": \"string\"}, {\"name\": \"isMinor\", \"type\": \"string\"}, {\"name\": \"isNew\", \"type\": \"string\"}, {\"name\": \"isRobot\", \"type\": \"string\"}, {\"name\": \"isUnpatrolled\", \"type\": \"string\"}, {\"name\": \"metroCode\", \"type\": \"string\"}, {\"name\": \"namespace\", \"type\": \"string\"}, {\"name\": \"page\", \"type\": \"string\"}, {\"name\": \"regionIsoCode\", \"type\": \"string\"}, {\"name\": \"regionName\", \"type\": \"string\"}, {\"name\": \"timestamp\", \"type\": \"string\"}, {\"name\": \"user\", \"type\": \"string\"}]'\n )\n)\nPARTITIONED BY DAY",
  7. "context": {
  8. "maxNumTasks": 3
  9. }
  10. })
  11. headers = {
  12. 'Content-Type': 'application/json'
  13. }
  14. response = requests.post(url, headers=headers, data=payload, auth=('USER', 'PASSWORD'))
  15. print(response.text)

Response

  1. {
  2. "taskId": "query-f795a235-4dc7-4fef-abac-3ae3f9686b79",
  3. "state": "RUNNING",
  4. }

Response fields

FieldDescription
taskIdController task ID. You can use Druid’s standard Tasks API to interact with this controller task.
stateInitial state for the query, which is “RUNNING”.

Get the status for a query task

You can retrieve status of a query to see if it is still running, completed successfully, failed, or got canceled.

Request

  • HTTP
  • curl
  • Python
  1. GET /druid/indexer/v1/task/<taskId>/status
  1. # Make sure you replace `username`, `password`, `your-instance`, `port`, and `taskId` with the values for your deployment.
  2. curl --location --request GET 'https://<username>:<password>@<your-instance>:<port>/druid/indexer/v1/task/<taskId>/status'
  1. import requests
  2. # Make sure you replace `your-instance`, `port`, and `taskId` with the values for your deployment.
  3. url = "https://<your-instance>:<port>/druid/indexer/v1/task/<taskId>/status"
  4. payload={}
  5. headers = {}
  6. response = requests.get(url, headers=headers, data=payload, auth=('USER', 'PASSWORD'))
  7. print(response.text)

Response

  1. {
  2. "task": "query-3dc0c45d-34d7-4b15-86c9-cdb2d3ebfc4e",
  3. "status": {
  4. "id": "query-3dc0c45d-34d7-4b15-86c9-cdb2d3ebfc4e",
  5. "groupId": "query-3dc0c45d-34d7-4b15-86c9-cdb2d3ebfc4e",
  6. "type": "query_controller",
  7. "createdTime": "2022-09-14T22:12:00.183Z",
  8. "queueInsertionTime": "1970-01-01T00:00:00.000Z",
  9. "statusCode": "RUNNING",
  10. "status": "RUNNING",
  11. "runnerStatusCode": "RUNNING",
  12. "duration": -1,
  13. "location": {
  14. "host": "localhost",
  15. "port": 8100,
  16. "tlsPort": -1
  17. },
  18. "dataSource": "kttm_simple",
  19. "errorMsg": null
  20. }
  21. }

Get the report for a query task

A report provides detailed information about a query task, including things like the stages, warnings, and errors.

Keep the following in mind when using the task API to view reports:

  • The task report for an entire job is associated with the query_controller task. The query_worker tasks do not have their own reports; their information is incorporated into the controller report.
  • The task report API may report 404 Not Found temporarily while the task is in the process of starting up.
  • As an experimental feature, the MSQ task engine supports running SELECT queries. SELECT query results are written into the multiStageQuery.payload.results.results task report key as an array of arrays. The behavior and result format of plain SELECT queries (without INSERT or REPLACE) is subject to change.
  • multiStageQuery.payload.results.resultsTruncated denote whether the results of the report have been truncated to prevent the reports from blowing up

For an explanation of the fields in a report, see Report response fields.

Request

  • HTTP
  • curl
  • Python
  1. GET /druid/indexer/v1/task/<taskId>/reports
  1. # Make sure you replace `username`, `password`, `your-instance`, `port`, and `taskId` with the values for your deployment.
  2. curl --location --request GET 'https://<username>:<password>@<your-instance>:<port>/druid/indexer/v1/task/<taskId>/reports'
  1. import requests
  2. # Make sure you replace `your-instance`, `port`, and `taskId` with the values for your deployment.
  3. url = "https://<your-instance>:<port>/druid/indexer/v1/task/<taskId>/reports"
  4. headers = {}
  5. response = requests.get(url, headers=headers, auth=('USER', 'PASSWORD'))
  6. print(response.text)

Response

The response shows an example report for a query.

Show the response

  1. {
  2. "multiStageQuery": {
  3. "type": "multiStageQuery",
  4. "taskId": "query-3dc0c45d-34d7-4b15-86c9-cdb2d3ebfc4e",
  5. "payload": {
  6. "status": {
  7. "status": "SUCCESS",
  8. "startTime": "2022-09-14T22:12:09.266Z",
  9. "durationMs": 28227,
  10. "pendingTasks": 0,
  11. "runningTasks": 2,
  12. "segmentLoadStatus": {
  13. "state": "SUCCESS",
  14. "dataSource": "kttm_simple",
  15. "startTime": "2022-09-14T23:12:09.266Z",
  16. "duration": 15,
  17. "totalSegments": 1,
  18. "usedSegments": 1,
  19. "precachedSegments": 0,
  20. "onDemandSegments": 0,
  21. "pendingSegments": 0,
  22. "unknownSegments": 0
  23. }
  24. },
  25. "stages": [
  26. {
  27. "stageNumber": 0,
  28. "definition": {
  29. "id": "71ecb11e-09d7-42f8-9225-1662c8e7e121_0",
  30. "input": [
  31. {
  32. "type": "external",
  33. "inputSource": {
  34. "type": "http",
  35. "uris": [
  36. "https://static.imply.io/example-data/kttm-v2/kttm-v2-2019-08-25.json.gz"
  37. ],
  38. "httpAuthenticationUsername": null,
  39. "httpAuthenticationPassword": null
  40. },
  41. "inputFormat": {
  42. "type": "json",
  43. "flattenSpec": null,
  44. "featureSpec": {},
  45. "keepNullColumns": false
  46. },
  47. "signature": [
  48. {
  49. "name": "timestamp",
  50. "type": "STRING"
  51. },
  52. {
  53. "name": "agent_category",
  54. "type": "STRING"
  55. },
  56. {
  57. "name": "agent_type",
  58. "type": "STRING"
  59. }
  60. ]
  61. }
  62. ],
  63. "processor": {
  64. "type": "scan",
  65. "query": {
  66. "queryType": "scan",
  67. "dataSource": {
  68. "type": "inputNumber",
  69. "inputNumber": 0
  70. },
  71. "intervals": {
  72. "type": "intervals",
  73. "intervals": [
  74. "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
  75. ]
  76. },
  77. "resultFormat": "compactedList",
  78. "columns": [
  79. "agent_category",
  80. "agent_type",
  81. "timestamp"
  82. ],
  83. "legacy": false,
  84. "context": {
  85. "finalize": false,
  86. "finalizeAggregations": false,
  87. "groupByEnableMultiValueUnnesting": false,
  88. "scanSignature": "[{\"name\":\"agent_category\",\"type\":\"STRING\"},{\"name\":\"agent_type\",\"type\":\"STRING\"},{\"name\":\"timestamp\",\"type\":\"STRING\"}]",
  89. "sqlInsertSegmentGranularity": "{\"type\":\"all\"}",
  90. "sqlQueryId": "3dc0c45d-34d7-4b15-86c9-cdb2d3ebfc4e",
  91. "sqlReplaceTimeChunks": "all"
  92. },
  93. "granularity": {
  94. "type": "all"
  95. }
  96. }
  97. },
  98. "signature": [
  99. {
  100. "name": "__boost",
  101. "type": "LONG"
  102. },
  103. {
  104. "name": "agent_category",
  105. "type": "STRING"
  106. },
  107. {
  108. "name": "agent_type",
  109. "type": "STRING"
  110. },
  111. {
  112. "name": "timestamp",
  113. "type": "STRING"
  114. }
  115. ],
  116. "shuffleSpec": {
  117. "type": "targetSize",
  118. "clusterBy": {
  119. "columns": [
  120. {
  121. "columnName": "__boost"
  122. }
  123. ]
  124. },
  125. "targetSize": 3000000
  126. },
  127. "maxWorkerCount": 1,
  128. "shuffleCheckHasMultipleValues": true
  129. },
  130. "phase": "FINISHED",
  131. "workerCount": 1,
  132. "partitionCount": 1,
  133. "startTime": "2022-09-14T22:12:11.663Z",
  134. "duration": 19965,
  135. "sort": true
  136. },
  137. {
  138. "stageNumber": 1,
  139. "definition": {
  140. "id": "71ecb11e-09d7-42f8-9225-1662c8e7e121_1",
  141. "input": [
  142. {
  143. "type": "stage",
  144. "stage": 0
  145. }
  146. ],
  147. "processor": {
  148. "type": "segmentGenerator",
  149. "dataSchema": {
  150. "dataSource": "kttm_simple",
  151. "timestampSpec": {
  152. "column": "__time",
  153. "format": "millis",
  154. "missingValue": null
  155. },
  156. "dimensionsSpec": {
  157. "dimensions": [
  158. {
  159. "type": "string",
  160. "name": "timestamp",
  161. "multiValueHandling": "SORTED_ARRAY",
  162. "createBitmapIndex": true
  163. },
  164. {
  165. "type": "string",
  166. "name": "agent_category",
  167. "multiValueHandling": "SORTED_ARRAY",
  168. "createBitmapIndex": true
  169. },
  170. {
  171. "type": "string",
  172. "name": "agent_type",
  173. "multiValueHandling": "SORTED_ARRAY",
  174. "createBitmapIndex": true
  175. }
  176. ],
  177. "dimensionExclusions": [
  178. "__time"
  179. ],
  180. "includeAllDimensions": false
  181. },
  182. "metricsSpec": [],
  183. "granularitySpec": {
  184. "type": "arbitrary",
  185. "queryGranularity": {
  186. "type": "none"
  187. },
  188. "rollup": false,
  189. "intervals": [
  190. "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
  191. ]
  192. },
  193. "transformSpec": {
  194. "filter": null,
  195. "transforms": []
  196. }
  197. },
  198. "columnMappings": [
  199. {
  200. "queryColumn": "timestamp",
  201. "outputColumn": "timestamp"
  202. },
  203. {
  204. "queryColumn": "agent_category",
  205. "outputColumn": "agent_category"
  206. },
  207. {
  208. "queryColumn": "agent_type",
  209. "outputColumn": "agent_type"
  210. }
  211. ],
  212. "tuningConfig": {
  213. "maxNumWorkers": 1,
  214. "maxRowsInMemory": 100000,
  215. "rowsPerSegment": 3000000
  216. }
  217. },
  218. "signature": [],
  219. "maxWorkerCount": 1
  220. },
  221. "phase": "FINISHED",
  222. "workerCount": 1,
  223. "partitionCount": 1,
  224. "startTime": "2022-09-14T22:12:31.602Z",
  225. "duration": 5891
  226. }
  227. ],
  228. "counters": {
  229. "0": {
  230. "0": {
  231. "input0": {
  232. "type": "channel",
  233. "rows": [
  234. 465346
  235. ],
  236. "files": [
  237. 1
  238. ],
  239. "totalFiles": [
  240. 1
  241. ]
  242. },
  243. "output": {
  244. "type": "channel",
  245. "rows": [
  246. 465346
  247. ],
  248. "bytes": [
  249. 43694447
  250. ],
  251. "frames": [
  252. 7
  253. ]
  254. },
  255. "shuffle": {
  256. "type": "channel",
  257. "rows": [
  258. 465346
  259. ],
  260. "bytes": [
  261. 41835307
  262. ],
  263. "frames": [
  264. 73
  265. ]
  266. },
  267. "sortProgress": {
  268. "type": "sortProgress",
  269. "totalMergingLevels": 3,
  270. "levelToTotalBatches": {
  271. "0": 1,
  272. "1": 1,
  273. "2": 1
  274. },
  275. "levelToMergedBatches": {
  276. "0": 1,
  277. "1": 1,
  278. "2": 1
  279. },
  280. "totalMergersForUltimateLevel": 1,
  281. "progressDigest": 1
  282. }
  283. }
  284. },
  285. "1": {
  286. "0": {
  287. "input0": {
  288. "type": "channel",
  289. "rows": [
  290. 465346
  291. ],
  292. "bytes": [
  293. 41835307
  294. ],
  295. "frames": [
  296. 73
  297. ]
  298. },
  299. "segmentGenerationProgress": {
  300. "type": "segmentGenerationProgress",
  301. "rowsProcessed": 465346,
  302. "rowsPersisted": 465346,
  303. "rowsMerged": 465346
  304. }
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }

The following table describes the response fields when you retrieve a report for a MSQ task engine using the /druid/indexer/v1/task/<taskId>/reports endpoint:

FieldDescription
multiStageQuery.taskIdController task ID.
multiStageQuery.payload.statusQuery status container.
multiStageQuery.payload.status.statusRUNNING, SUCCESS, or FAILED.
multiStageQuery.payload.status.startTimeStart time of the query in ISO format. Only present if the query has started running.
multiStageQuery.payload.status.durationMsMilliseconds elapsed after the query has started running. -1 denotes that the query hasn’t started running yet.
multiStageQuery.payload.status.pendingTasksNumber of tasks that are not fully started. -1 denotes that the number is currently unknown.
multiStageQuery.payload.status.runningTasksNumber of currently running tasks. Should be at least 1 since the controller is included.
multiStageQuery.payload.status.segmentLoadStatusSegment loading container. Only present after the segments have been published.
multiStageQuery.payload.status.segmentLoadStatus.stateEither INIT, WAITING, SUCCESS, FAILED or TIMED_OUT.
multiStageQuery.payload.status.segmentLoadStatus.startTimeTime since which the controller has been waiting for the segments to finish loading.
multiStageQuery.payload.status.segmentLoadStatus.durationThe duration in milliseconds that the controller has been waiting for the segments to load.
multiStageQuery.payload.status.segmentLoadStatus.totalSegmentsThe total number of segments generated by the job. This includes tombstone segments (if any).
multiStageQuery.payload.status.segmentLoadStatus.usedSegmentsThe number of segments which are marked as used based on the load rules. Unused segments can be cleaned up at any time.
multiStageQuery.payload.status.segmentLoadStatus.precachedSegmentsThe number of segments which are marked as precached and served by historicals, as per the load rules.
multiStageQuery.payload.status.segmentLoadStatus.onDemandSegmentsThe number of segments which are not loaded on any historical, as per the load rules.
multiStageQuery.payload.status.segmentLoadStatus.pendingSegmentsThe number of segments remaining to be loaded.
multiStageQuery.payload.status.segmentLoadStatus.unknownSegmentsThe number of segments whose status is unknown.
multiStageQuery.payload.status.errorReportError object. Only present if there was an error.
multiStageQuery.payload.status.errorReport.taskIdThe task that reported the error, if known. May be a controller task or a worker task.
multiStageQuery.payload.status.errorReport.hostThe hostname and port of the task that reported the error, if known.
multiStageQuery.payload.status.errorReport.stageNumberThe stage number that reported the error, if it happened during execution of a specific stage.
multiStageQuery.payload.status.errorReport.errorError object. Contains errorCode at a minimum, and may contain other fields as described in the error code table. Always present if there is an error.
multiStageQuery.payload.status.errorReport.error.errorCodeOne of the error codes from the error code table. Always present if there is an error.
multiStageQuery.payload.status.errorReport.error.errorMessageUser-friendly error message. Not always present, even if there is an error.
multiStageQuery.payload.status.errorReport.exceptionStackTraceJava stack trace in string form, if the error was due to a server-side exception.
multiStageQuery.payload.stagesArray of query stages.
multiStageQuery.payload.stages[].stageNumberEach stage has a number that differentiates it from other stages.
multiStageQuery.payload.stages[].phaseEither NEW, READING_INPUT, POST_READING, RESULTS_COMPLETE, or FAILED. Only present if the stage has started.
multiStageQuery.payload.stages[].workerCountNumber of parallel tasks that this stage is running on. Only present if the stage has started.
multiStageQuery.payload.stages[].partitionCountNumber of output partitions generated by this stage. Only present if the stage has started and has computed its number of output partitions.
multiStageQuery.payload.stages[].startTimeStart time of this stage. Only present if the stage has started.
multiStageQuery.payload.stages[].durationThe number of milliseconds that the stage has been running. Only present if the stage has started.
multiStageQuery.payload.stages[].sortA boolean that is set to true if the stage does a sort as part of its execution.
multiStageQuery.payload.stages[].definitionThe object defining what the stage does.
multiStageQuery.payload.stages[].definition.idThe unique identifier of the stage.
multiStageQuery.payload.stages[].definition.inputArray of inputs that the stage has.
multiStageQuery.payload.stages[].definition.broadcastArray of input indexes that get broadcasted. Only present if there are inputs that get broadcasted.
multiStageQuery.payload.stages[].definition.processorAn object defining the processor logic.
multiStageQuery.payload.stages[].definition.signatureThe output signature of the stage.

Cancel a query task

Request

  • HTTP
  • curl
  • Python
  1. POST /druid/indexer/v1/task/<taskId>/shutdown
  1. # Make sure you replace `username`, `password`, `your-instance`, `port`, and `taskId` with the values for your deployment.
  2. curl --location --request POST 'https://<username>:<password>@<your-instance>:<port>/druid/indexer/v1/task/<taskId>/shutdown'
  1. import requests
  2. # Make sure you replace `your-instance`, `port`, and `taskId` with the values for your deployment.
  3. url = "https://<your-instance>:<port>/druid/indexer/v1/task/<taskId>/shutdown"
  4. payload={}
  5. headers = {}
  6. response = requests.post(url, headers=headers, data=payload, auth=('USER', 'PASSWORD'))
  7. print(response.text)

Response

  1. {
  2. "task": "query-655efe33-781a-4c50-ae84-c2911b42d63c"
  3. }