Array values in an index are cross joined?

I’d just like to confirm this since I can’t find any mention of this behaviour in the documentation.

I tested this with this data:

{
  "arr": [
    {
      "foo": 1,
      "bar": 2
    },
    {
      "foo": 3,
      "bar": 4
    }
  ]
}

and this index:

{
  name: "test",
  collection: Collection("test"),
  values: [
    {
      field: ["data", "arr", "foo"]
    },
    {
      field: ["data", "arr", "bar"]
    }
  ]
}

and the index contains this:

Paginate(Match("test"))

{
  data: [
    [1, 2],
    [1, 4],
    [3, 2],
    [3, 4]
  ]
}

I was hoping I could paginate through the array elements like this, but c’est la vie ¯\_(ツ)_/¯

When an index definition specifies a field that is an array, Fauna creates one index entry per array item. You can think of the array as a list of alternatives that can be searched for. This is described here: Indexes | Fauna Documentation

Because each array item causes an index entry to be created, and each index entry has to contain all if the index’s terms fields, the resulting index entry for two fields that involve array items is a single permutation of the matrix of all possible permutations.

This latter behaviour could be explained better in the documentation; I’ve filed an issue to do so (DOCS-1663).