History service produce weird results

We are using the history service in order to build some custom analytics UI in the following way:

historyService.createHistoricProcessInstanceQuery()
            .tenantIdIn(currentTenant)
            .startedAfter(range.from)
            .startedBefore(range.until)

But experiencing very weird situation…
Assuming range=[2021-08-09, 2021-09-08] results are:

  1. A
  2. B

And with range=[2021-09-01,2021-09-08] results are:

  1. X
  2. Y

In my understanding the first call (the one with wider range) should have produced the following results:

  1. A
  2. B
  3. X
  4. Y

(or maybe in different order but still)

Is this correct or our assumption is wrong?

Hi @vicmosin,

If A and B started before 09-01 (between 08-09 and 09-01) then they wouldn’t be part of the result coming from the 2nd call but yes all should be part of the 1st call.

Below snip is interrupted as AND condition

.startedAfter(range.from)
.startedBefore(range.until)