'MariaDB - is it possible to index JSON arrays?

When working with JSON in MariaDB it is possible to index single-point values using virtual columns e.g.

ALTER TABLE features ADD feature_street VARCHAR(30) AS (JSON_UNQUOTE(feature->"$.properties.STREET"));
ALTER TABLE features ADD INDEX (feature_street);

Does anybody know whether it is possible to index JSON arrays in the same way so that when querying based on the values of the array members, each array does not have to be scanned?

I can't find anything in the docs which suggests this is possible.



Solution 1:[1]

Create a "virtual" column of the element of the JSON column and index it.

https://mariadb.com/kb/en/mariadb/virtual-computed-columns/

The elements of an array inside a JSON string -- That is another matter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1