How to use 'Query Cancellation'?

I’d like to use query cancellation api (http://druid.io/docs/0.8.1/querying/querying.html) when query computing time is too long for users to wait and reduce burden of druid cluster.
However, a query id in the response header field ‘X-Druid-Query-Id’ can only be found when full response has came over, which is not useful for my case.

Is there any idea or point I have missed for this case? Please let me know how to use query cancellation api efficiently.

(In my case, I use Java client to query to druid cluster.)

Hey Trevor,

If you want to cancel long queries, you can set a “timeout” in the query context. It would look like, “context”: {“timeout”: 60000} at the root level of the query. The timeout is in milliseconds.

Thanks Gian! It seems much more easy than using X-Druid-Query-Id :slight_smile: