Reputation: 587
I am trying to create an index in redis with the following code
$schema = [
new NumericField('doc_id'),
new NumericField('entity_id'),
new VectorField('embedding', 'HNSW', ['DIM' => 768, 'DISTANCE_METRIC' => 'COSINE']),
new TagField('users'),
new TagField('url'),
];
return Redis::ftCreate('testVector', $schema, []);
An raise this error :/
Predis\Response\ServerException Bad arguments for algorithm HNSW: 768
Any idea what I am doing wrong?
Upvotes: 0
Views: 102
Reputation: 587
I found the error, the parameters are not with keys.
$schema = [
new NumericField('doc_id'),
new NumericField('entity_id'),
// VectorField cosine algorithm
new VectorField('embedding', 'HNSW', ['TYPE', 'FLOAT64', 'DIM', 768, 'DISTANCE_METRIC', 'COSINE']),
new TagField('users'),
new TagField('url'),
];
Upvotes: 0