REST orQueries (Historic Process Instance statuses)

I’m trying to retrieve process instance history and filter the results using multiple statuses at the same time. For instance, to retrieve all historic process instances with an active or completed status and filter out those that are suspended or terminated, I am using the following request:

POST /history/process-instance
{
    "orQueries": [
        { "active": true, "completed": true }
    ]
}

The documentation states:

orQueries: A JSON array of nested historic process instance queries with OR semantics. A process instance matches a nested query if it fulfills at least one of the query’s predicates. With multiple nested queries, a process instance must fulfill at least one predicate of each query (Conjunctive Normal Form).

As such, I believe the above request should return the results that I’m looking for but instead I get an error response: “Already querying for historic process instance with another state: ACTIVE is not null”.

After briefly looking at the source code here, I believe that some validation has been put in place so that AND semantics cannot be applied to multiple filters (as they are mutually exclusive). But I don’t think it’s correct that this validation is applied to OR semantics as it is completely valid to filter more than one status at a time.

Please could someone investigate? I think this is either a bug in the code or the documentation is incorrect.

1 Like

I’m having the same problem. As an example, it does not seem possible to obtain both externallyTerminated and internallyTerminated processes.