Cancel a Running Search

With ChaosSearch, you can cancel your in-progress ElasticSearch API search.

ChaosSearch added support for a Cancel Query button in the ChaosSearch console that allows users to cancel their in-progress Discover search.

Similarly, API users can cancel an in-progress ElasticSearch API search/msearch with the /query/cancel endpoint. The following examples show cancel operations that use JWT authentication, or that use ChaosSearch API key authentication (in early development) with these curl or python examples:

curl 'https://mycompany.chaossearch.io/query/cancel' \
  -H 'x-amz-security-token: eyJ0e6E3MhWn2CNX_xXdbH20fVJPw9CZC1A' <--shortened for doc
curl --aws-sigv4 "aws:amz:<region>:s3" \
  --user "<API key>:<API secret>"
   --url 'https://mycompany.chaossearch.com/query/cancel' 
import requests
from requests_auth_aws_sigv4 import AWSSigV4

aws_auth = AWSSigV4(
    's3',
    aws_access_key_id="<API key",
    aws_secret_access_key="???",
)
r = requests.request("POST", "https://mycompany.chaossearch.io/query/cancel", auth=aws_auth)
print(r)
print(r.text)

For authentication with a JWT, you create a token using the /user/login endpoint for the subaccount user who launched the in-progress search. The cancel query operation stops an in-progress search running for that user. Similarly, if the search is launched with a user's ChaosSearch API Key and secret, the API key and python examples show the syntax for those methods.

When a search is canceled, the following message is returned to the in-progress search/msearch endpoint or Discover UI:

{"body":{"responses":[{"error":"Task cancelled. Task cancelled.","status":200}]},"statusCode":200}

📘

This feature is available for embedded analytics customers on worker-based pricing.

Contact your ChaosSearch Customer Success representative for more information about this feature.