Two Indexes on one Collection giving different number of entries

This is either me doing something wrong, or a rather serious bug.

To make backup exports I have been using a rather simple script. But recently I found that this script is maybe not returning all entries, making the backups incomplete.

I have a Collection called laadpalen and a basic index called all_laadpalen with default settings (serialized, not unique and giving back refs).

client.query(
  q.Map(
    q.Paginate(
      q.Match(q.Index('all_laadpalen'), { size: 100000 }
    ),
    q.Lambda("X", q.Get(q.Var("X")))
  )
).then(response => response.data)

This query gives back 39205 results.

In my application I used more specific indexes, one of which (laadpalen_by_code) is based on a code term. Each entry in laadpalen has a code value. Otherwise it’s the same: serialized, not unique and giving back refs.

What I recently found was that the all_laadpalen index gave back 192 entries with the code 0828, while the laadpalen_by_code index gave back 296 entries.

Setting up a new query to gather all entries with the laadpalen_by_code index using Union (code below) gave 39638, a difference of 436 entries.

My question: how can this be? Did I do something wrong? Or is the all_laadpalen index broken?

client.query(
  q.Map(
    q.Paginate(
      q.Union(
        q.Match(q.Index('laadpalen_by_code'), '0828'),
        q.Match(q.Index('laadpalen_by_code'), '0753'), 
        [...]
      ),
      { size: 100000 }
    ),
    q.Lambda("X", q.Get(q.Var("X")))
  )
).then(response => response.data)

Hi @Wouter_van_Dam,

may you contact me in private for sharing more information?

Thanks,

Luigi