Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ jobs:
run: |
(cd website && npm install)
cd website
npm run link-lint
npm run spellcheck

- name: web console
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ integration-tests/gen-scripts/
**/druidapi.egg-info/
examples/quickstart/jupyter-notebooks/docker-jupyter/notebooks
website/i18n/*
website/.docusaurus/
# ignore NetBeans IDE specific files
nbproject
nbactions.xml
Expand Down
6 changes: 4 additions & 2 deletions docs/api-reference/data-management-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ This document describes the data management API endpoints for Apache Druid. This

While segments may be enabled by issuing POST requests for the datasources, the Coordinator may again disable segments if they match any configured [drop rules](../operations/rule-configuration.md#drop-rules). Even if segments are enabled by these APIs, you must configure a [load rule](../operations/rule-configuration.md#load-rules) to load them onto Historical processes. If an indexing or kill task runs at the same time these APIs are invoked, the behavior is undefined. Some segments might be killed and others might be enabled. It's also possible that all segments might be disabled, but the indexing task can still read data from those segments and succeed.

> Avoid using indexing or kill tasks and these APIs at the same time for the same datasource and time chunk.
:::info
Avoid using indexing or kill tasks and these APIs at the same time for the same datasource and time chunk.
:::

`POST /druid/coordinator/v1/datasources/{dataSourceName}`

Expand Down Expand Up @@ -76,4 +78,4 @@ Runs a [Kill task](../ingestion/tasks.md) for a given interval and datasource.

Marks as unused a segment of a datasource. Returns a JSON object of the form `{"segmentStateChanged": <boolean>}` with
the boolean indicating if the state of the segment has been changed (that is, the segment was marked as unused) as the
result of this API call.
result of this API call.
77 changes: 51 additions & 26 deletions docs/api-reference/json-querying-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ id: json-querying-api
title: JSON querying API
sidebar_label: JSON querying
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


<!--

~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
Expand Down Expand Up @@ -33,7 +37,7 @@ In this topic, `http://SERVICE_IP:SERVICE_PORT` is a placeholder for the server
Submits a JSON-based native query. The body of the request is the native query itself.

Druid supports different types of queries for different use cases. All queries require the following properties:
* `queryType`: A string representing the type of query. Druid supports the following native query types: `timeseries`, `topN`, `groupBy`, `timeBoundaries`, `segmentMetadata`, `datasourceMetadata`, `scan`, and `search`.
* `queryType`: A string representing the type of query. Druid supports the following native query types: `timeseries`, `topN`, `groupBy`, `timeBoundaries`, `segmentMetadata`, `datasourceMetadata`, `scan`, and `search`.
* `dataSource`: A string or object defining the source of data to query. The most common value is the name of the datasource to query. For more information, see [Datasources](../querying/datasource.md).

For additional properties based on your query type or use case, see [available native queries](../querying/querying.md#available-queries).
Expand All @@ -49,13 +53,16 @@ For additional properties based on your query type or use case, see [available n

### Responses

<!--DOCUSAURUS_CODE_TABS-->
<Tabs>

<TabItem value="1" label="200 SUCCESS">


<!--200 SUCCESS-->
*Successfully submitted query*

*Successfully submitted query*
</TabItem>
<TabItem value="2" label="400 BAD REQUEST">

<!--400 BAD REQUEST-->

*Error thrown due to bad query. Returns a JSON object detailing the error with the following format:*

Expand All @@ -69,17 +76,19 @@ For additional properties based on your query type or use case, see [available n
```
For more information on possible error messages, see [query execution failures](../querying/querying.md#query-execution-failures).

<!--END_DOCUSAURUS_CODE_TABS-->
</TabItem>
</Tabs>

---

### Example query: `topN`

The following example shows a `topN` query. The query analyzes the `social_media` datasource to return the top five users from the `username` dimension with the highest number of views from the `views` metric.
The following example shows a `topN` query. The query analyzes the `social_media` datasource to return the top five users from the `username` dimension with the highest number of views from the `views` metric.

<!--DOCUSAURUS_CODE_TABS-->
<Tabs>

<TabItem value="3" label="cURL">

<!--cURL-->

```shell
curl "http://ROUTER_IP:ROUTER_PORT/druid/v2?pretty=null" \
Expand All @@ -103,7 +112,9 @@ curl "http://ROUTER_IP:ROUTER_PORT/druid/v2?pretty=null" \
]
}'
```
<!--HTTP-->
</TabItem>
<TabItem value="4" label="HTTP">


```HTTP
POST /druid/v2?pretty=null HTTP/1.1
Expand Down Expand Up @@ -131,7 +142,8 @@ Content-Length: 336
}
```

<!--END_DOCUSAURUS_CODE_TABS-->
</TabItem>
</Tabs>

#### Example response: `topN`

Expand Down Expand Up @@ -179,9 +191,10 @@ In this query:
* The `upvoteToPostRatio` is a post-aggregation of the `upvoteSum` and the `postCount`, divided to calculate the ratio.
* The result is sorted based on the `upvoteToPostRatio` in descending order.

<!--DOCUSAURUS_CODE_TABS-->
<Tabs>

<TabItem value="5" label="cURL">

<!--cURL-->

```shell
curl "http://ROUTER_IP:ROUTER_PORT/druid/v2" \
Expand Down Expand Up @@ -217,7 +230,9 @@ curl "http://ROUTER_IP:ROUTER_PORT/druid/v2" \
}'
```

<!--HTTP-->
</TabItem>
<TabItem value="6" label="HTTP">


```HTTP
POST /druid/v2?pretty=null HTTP/1.1
Expand Down Expand Up @@ -256,12 +271,14 @@ Content-Length: 817
}
```

<!--END_DOCUSAURUS_CODE_TABS-->
</TabItem>
</Tabs>

#### Example response: `groupBy`

<details>
<summary>Click to show sample response</summary>

```json
[
{
Expand All @@ -280,7 +297,7 @@ Content-Length: 817

## Get segment information for query

Retrieves an array that contains objects with segment information, including the server locations associated with the query provided in the request body.
Retrieves an array that contains objects with segment information, including the server locations associated with the query provided in the request body.

### URL

Expand All @@ -292,13 +309,16 @@ Retrieves an array that contains objects with segment information, including the

### Responses

<!--DOCUSAURUS_CODE_TABS-->
<Tabs>

<TabItem value="7" label="200 SUCCESS">


<!--200 SUCCESS-->
*Successfully retrieved segment information*

*Successfully retrieved segment information*
</TabItem>
<TabItem value="8" label="400 BAD REQUEST">

<!--400 BAD REQUEST-->

*Error thrown due to bad query. Returns a JSON object detailing the error with the following format:*

Expand All @@ -312,15 +332,17 @@ Retrieves an array that contains objects with segment information, including the
```
For more information on possible error messages, see [query execution failures](../querying/querying.md#query-execution-failures).

<!--END_DOCUSAURUS_CODE_TABS-->
</TabItem>
</Tabs>

---

### Sample request

<!--DOCUSAURUS_CODE_TABS-->
<Tabs>

<TabItem value="9" label="cURL">

<!--cURL-->

```shell
curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/candidates" \
Expand All @@ -345,7 +367,9 @@ curl "http://ROUTER_IP:ROUTER_PORT/druid/v2/candidates" \
}'
```

<!--HTTP-->
</TabItem>
<TabItem value="10" label="HTTP">


```HTTP
POST /druid/v2/candidates HTTP/1.1
Expand Down Expand Up @@ -374,7 +398,8 @@ Content-Length: 336
}
```

<!--END_DOCUSAURUS_CODE_TABS-->
</TabItem>
</Tabs>

### Sample response

Expand Down Expand Up @@ -895,4 +920,4 @@ Content-Length: 336
}
]
```
</details>
</details>
41 changes: 28 additions & 13 deletions docs/api-reference/legacy-metadata-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ If no used segments are found for the given inputs, this API returns `204 No Con

## Metadata store information

> Note: Much of this information is available in a simpler, easier-to-use form through the Druid SQL
> [`sys.segments`](../querying/sql-metadata-tables.md#segments-table) table.
:::info

Note: Much of this information is available in a simpler, easier-to-use form through the Druid SQL
[`sys.segments`](../querying/sql-metadata-tables.md#segments-table) table.

:::

`GET /druid/coordinator/v1/metadata/segments`

Expand Down Expand Up @@ -279,10 +283,14 @@ This section documents the API endpoints for the processes that reside on Query
Note that all _interval_ URL parameters are ISO 8601 strings delimited by a `_` instead of a `/`
as in `2016-06-27_2016-06-28`.

> Note: Much of this information is available in a simpler, easier-to-use form through the Druid SQL
> [`INFORMATION_SCHEMA.TABLES`](../querying/sql-metadata-tables.md#tables-table),
> [`INFORMATION_SCHEMA.COLUMNS`](../querying/sql-metadata-tables.md#columns-table), and
> [`sys.segments`](../querying/sql-metadata-tables.md#segments-table) tables.
:::info

Note: Much of this information is available in a simpler, easier-to-use form through the Druid SQL
[`INFORMATION_SCHEMA.TABLES`](../querying/sql-metadata-tables.md#tables-table),
[`INFORMATION_SCHEMA.COLUMNS`](../querying/sql-metadata-tables.md#columns-table), and
[`sys.segments`](../querying/sql-metadata-tables.md#segments-table) tables.

:::

`GET /druid/v2/datasources`

Expand All @@ -296,18 +304,25 @@ If no interval is specified, a default interval spanning a configurable period b

`GET /druid/v2/datasources/{dataSourceName}/dimensions`

> This API is deprecated and will be removed in future releases. Please use [SegmentMetadataQuery](../querying/segmentmetadataquery.md) instead
> which provides more comprehensive information and supports all dataSource types including streaming dataSources. It's also encouraged to use [INFORMATION_SCHEMA tables](../querying/sql-metadata-tables.md)
> if you're using SQL.
>
:::info

This API is deprecated and will be removed in future releases. Please use [SegmentMetadataQuery](../querying/segmentmetadataquery.md) instead
which provides more comprehensive information and supports all dataSource types including streaming dataSources. It's also encouraged to use [INFORMATION_SCHEMA tables](../querying/sql-metadata-tables.md)
if you're using SQL.

:::

Returns the dimensions of the datasource.

`GET /druid/v2/datasources/{dataSourceName}/metrics`

> This API is deprecated and will be removed in future releases. Please use [SegmentMetadataQuery](../querying/segmentmetadataquery.md) instead
> which provides more comprehensive information and supports all dataSource types including streaming dataSources. It's also encouraged to use [INFORMATION_SCHEMA tables](../querying/sql-metadata-tables.md)
> if you're using SQL.
:::info

This API is deprecated and will be removed in future releases. Please use [SegmentMetadataQuery](../querying/segmentmetadataquery.md) instead
which provides more comprehensive information and supports all dataSource types including streaming dataSources. It's also encouraged to use [INFORMATION_SCHEMA tables](../querying/sql-metadata-tables.md)
if you're using SQL.

:::
Returns the metrics of the datasource.

`GET /druid/v2/datasources/{dataSourceName}/candidates?intervals={comma-separated-intervals}&numCandidates={numCandidates}`
Expand Down
Loading