To work with a GIN index use the <@
("is contained by") operator instead of the ANY
construct.
The manual states here that default GIN indexes currently only support these operators (additional functionality is shipped with extensions):
<@
@>
=
&&
So try this query:
Document.where("'{divisible by 5}' <@ tags").explain
Note that the left hand side needs to be in array notation
, too, even if it's a single element. The operator <@
works for arrays. Hence '{divisible by 5}'
.