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:
- (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.