Describe the bug

Including un-indexed fields in FT.SEARCH RETURN, using HIGHLIGHT throws an error

To reproduce

  1. Create an index for JSON with fields "name" and "description" AS Text.
  2. Add an item with "name", "description" and "someExtraValue".
  3. Query with HIGHLIGHT

Example: FT.SEARCH myIndex "term" RETURN 2 name description HIGHLIGHT FIELDS 2 name description

Works perfectly, the "term" is highlighted in the result.

FT.SEARCH myIndex "term" RETURN 5 name description $.someExtraValue AS extra

This works as well, the results includes the field "extra" with the expected content from $.someExtraValue

FT.SEARCH myIndex "term" RETURN 5 name description $.someExtraValue AS extra HIGHLIGHT FIELDS 2 name description

Combining the two queries above throws an error:

Property _$.someExtraValue_ is not in schema

Expected behavior

I expected HIGHLIGHT to only consider the fields provided (FIELDS 2 name description), not the other fields in the RETURN ($.someExtraValue AS extra)

Additional information

Tested with Redis Stack 7.4.1, redis-cli, and Redis insight

Comment From: sundb

@carlhaman please move this issue to https://github.com/RediSearch/RediSearch/issues, thanks.

Comment From: carlhaman

I don´t have the option to transfer the issue, but I created a new one:

https://github.com/RediSearch/RediSearch/issues/5132