Filtering tasks

    Querying the get tasks endpoint returns all tasks that have not been deleted. This unfiltered list may be difficult to parse in large projects.

    This guide shows you how to use query parameters to filter tasks and obtain a more readable list of asynchronous operations.

    Requirements

    Filtering tasks with a single parameter

    Use the get tasks endpoint to fetch all cancelled tasks:

    curl \
      -X GET 'http://localhost:7700/tasks?statuses=failed'

    Use a comma to separate multiple values and fetch both cancelled and failed tasks:

    curl \
      -X GET 'http://localhost:7700/tasks?statuses=failed,canceled'

    You may filter tasks based on uid, status, type, indexUid, canceledBy, or date. Consult the API reference for a full list of task filtering parameters.

    Combining filters

    Use the ampersand character (&) to combine filters, equivalent to a logical AND:

    curl \
      -X GET 'http://localhost:7700/tasks?indexUids=movies&types=documentAdditionOrUpdate,documentDeletion&statuses=processing'

    This code sample returns all tasks in the movies index that have the type documentAdditionOrUpdate or documentDeletion and have the status of processing.

    WARNING

    OR operations between different filters are not supported. For example, you cannot view tasks which have a type of documentAddition or a status of failed.