Search code examples
jsonredisredisearchredisjson

How to the @ symbol in RediSearch?


I'm using the modules RedisJSON and RediSearch together to perform search queries on JSON data. Given a json list like this:

{"email": "[email protected]", "is_checked": 1}

I do:

FT.CREATE myidx ON JSON SCHEMA $.email AS email TAG
FT.SEARCH myidx "@email:'[email protected]'"

but I got Syntax error

How can I select with the value "[email protected]"?


Solution

  • You can escape special characters, like @, with a backslash:

    FT.SEARCH myidx "@email:'test1\@example.com'"
    

    That should do the trick.