FT.SEARCH doesn't return all documents

I have set up an index named “itemIdx” using the following schema:

FT.CREATE itemIdx ON JSON PREFIX 1 item: SCHEMA $.name AS name TEXT $.description as description TEXT $.price AS price NUMERIC $.embedding AS embedding VECTOR FLAT 6 DIM 4 DISTANCE_METRIC L2 TYPE FLOAT32

The index is supposed to allow me to efficiently search through JSON documents containing product information. Each document includes fields such as “name,” “description,” “price,” and “embedding,” among others.

added tow document to the index:

JSON.SET item:1 $ ‘{“name”:“Noise-cancelling Bluetooth headphones”,“description”:“Wireless Bluetooth headphones with noise-cancelling technology”,“connection”:{“wireless”:true,“type”:“Bluetooth”},“price”:99.98,“stock”:25,“colors”:[“black”,“silver”],“embedding”:[0.87,-0.15,0.55,0.03]}’

JSON.SET item:2 $ ‘{“name”:“Wireless earbuds”,“description”:“Wireless Bluetooth in-ear headphones”,“connection”:{“wireless”:true,“type”:“Bluetooth”},“price”:64.99,“stock”:17,“colors”:[“black”,“white”],“embedding”:[-0.7,-0.51,0.88,0.14]}’

The issue arises when attempting to use FT.SEARCH to find documents based on the “name” field.
When I run the command:

FT.SEARCH itemIdx ‘@name:(earbuds)’

I only get the following response:

  1. (integer) 0

I expected to receive both documents as a result, but it seems that only the first document with the name “Noise-cancelling Bluetooth headphones” is returned.

I’ve checked the index schema and documents; they appear to be correctly set up. However, I suspect there might be a problem with the FT.SEARCH command or how the index is constructed.

If you’re searching for “earbuds” in the name property, getting both documents, one of which does not have “earbuds” in the name, should not be an expected result.

This would certainly be wrong, but it contradicts the RediSearch response you pasted directly above that, which had no results at all. As a reader, it’s impossible for me to tell which response you actually received from running the search.

When I use the commands you pasted here (the only modification being running them through a smart-quotes-to-regular-quotes tool), it returns the only one of the documents that has “earbuds” in the name property:> FT.SEARCH itemIdx '@name:(earbuds)'
1) (integer) 1
2) "item:2"
3) 1) "$"
   2) "{\"name\":\"Wireless earbuds\",\"description\":\"Wireless Bluetooth in-ear headphones\",\"connection\":{\"wireless\":true,\"type\":\"Bluetooth\"},\"price\":64.99,\"stock\":17,\"colors\":[\"black\",\"white\"],\"embedding\":[-0.7,-0.51,0.88,0.14]}"