Syntax:
JSON_SEARCH(json_doc, one_or_all, search_str[, escape_char[, path]
...])

Returns the path to the given string within a JSON document. Returns
NULL if any of the json_doc, search_str, or path arguments are NULL; no
path exists within the document; or search_str is not found. An error
occurs if the json_doc argument is not a valid JSON document, any path
argument is not a valid path expression, one_or_all is not 'one' or
'all', or escape_char is not a constant expression.

The one_or_all argument affects the search as follows:

o 'one': The search terminates after the first match and returns one
  path string. It is undefined which match is considered first.

o 'all': The search returns all matching path strings such that no
  duplicate paths are included. If there are multiple strings, they are
  autowrapped as an array. The order of the array elements is
  undefined.

Within the search_str search string argument, the % and _ characters
work as for the LIKE operator: % matches any number of characters
(including zero characters), and _ matches exactly one character.

To specify a literal % or _ character in the search string, precede it
by the escape character. The default is \ if the escape_char argument
is missing or NULL. Otherwise, escape_char must be a constant that is
empty or one character.

For more information about matching and escape character behavior, see
the description of LIKE in
https://dev.mysql.com/doc/refman/8.0/en/string-comparison-functions.html
. For escape character handling, a difference from the LIKE behavior
is that the escape character for JSON_SEARCH() must evaluate to a
constant at compile time, not just at execution time. For example, if
JSON_SEARCH() is used in a prepared statement and the escape_char
argument is supplied using a ? parameter, the parameter value might be
constant at execution time, but is not at compile time.

search_str and path are always interpreted as utf8mb4 strings,
regardless of their actual encoding. This is a known issue which is
fixed in MySQL 8.0.24 ( Bug #32449181).

URL: https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html

