#community-help

Error in Implementing Vector Search

TLDR Krish faced an error while implementing vector search. After recreating the collection as suggested by Kishore Nallan, the issue was resolved.

Powered by Struct AI

2

Apr 05, 2023 (8 months ago)
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:02 AM
Hello! I am currently on 0.24 and trying to implement vector search. Below is my schema. But when I trying a search as mentioned below I am getting error: "{'results': [{'code': 400, 'error': 'Field embeddings does not have a vector query index.'}]}". Not sure where I am going wrong. Can you help please?
search_requests = {
'searches': [{
'collection': 'wh-records',
'q': '*',
'vector_query': 'embeddings:([1.4580078, -1.7529297, -0.16894531, 2.4335938,....], k:50)',
'per_page': 50,
'exclude_fields': 'embeddings'
}]
}
common_search_params = {}
result = typesenseClient.multi_search.perform(search_requests, common_search_params)
print(result)
schema = {
  "name": "wh-records",
  "fields": [
    {
      "name"  :  "id",
      "type"  :  "string"
    },
    {
      "name"  :  "title",
      "type"  :  "string",
      "facet" :  True
    },
    {
      "name"  :  "url",
      "type"  :  "string"
    },
    {
      "name"  :  "date",
      "type"  :  "string"
    },
    {
      "name"  :  "summary",
      "type"  :  "string",
      "facet" :  True
    },
    {
      "name"  :  "embeddings",
      "type"  :  "float[]",
      "num_dim" :  4096
    }
  ] 
}
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:09 AM
Query field name is wrong, should be "vector"
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:09 AM
Sorry, thats a copy paste error. it is embeddings
06:10
Krish
06:10 AM
 {
        "facet": false,
        "index": true,
        "infix": false,
        "locale": "",
        "name": "embeddings",
        "optional": false,
        "sort": false,
        "type": "float[]"
      },
06:10
Krish
06:10 AM
from the collection.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:10 AM
Try creating a standalone example where the error occurs and share it with me so I can reproduce
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:11 AM
standalone example as in?
06:11
Krish
06:11 AM
I did not see this issue in 0.24.0.rcn56
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:12 AM
What are you using now?
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:12 AM
now I moved to 0.24.0
06:12
Krish
06:12 AM
let me try in curl and see
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:13 AM
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:19 AM
This worked!

1

06:23
Krish
06:23 AM
So, what does this "field embeddings does not have a vector query index." mean?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:24 AM
I can't say unless you gave me a fully reproduce able example to run
06:25
Kishore Nallan
06:25 AM
But that error broadly means that somehow the field was not detected as vector field. This happens if you had omitted num_dim for example when creating collection.
Krish
Photo of md5-7dff5651efcba5c9cdfac93918dc7eeb
Krish
06:26 AM
ok, let me create the collection again try
06:53
Krish
06:53 AM
dropping the collection and recreating it worked. May be there was something wrong in the previous one.

1

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Integrating Semantic Search with Typesense

Krish wants to integrate a semantic search functionality with typesense but struggles with the limitations. Kishore Nallan provides resources, clarifications and workarounds to the raised issues.

6

75
11mo

Utilizing Vector Search and Word Embeddings for Comprehensive Search in Typesense

Bill sought clarification on using vector search with multiple word embeddings in Typesense and using them instead of OpenAI's embedding. Kishore Nallan and Jason informed him that their development version 0.25 supports open source embedding models. They also resolved Bill's concerns regarding search performance, language support, and limitations in the search parameters.

11

225
4mo

Hybrid Search Distance Threshold Issue

Anish has an issue with search results not respecting the vector distance threshold when using hybrid search. Jason explains additional fields cause `vector_distance` to only apply to vector search results and suggests opening a feature request on GitHub.

2

13
2mo

Issue with Embedding Error in Version 0.25.0.rc63

Bill reported a bug in version 0.25.0.rc63 regarding a problem with updating or emplacing a document and receiving an embedding error. This was resolved in version 0.25.0.rc65, but further discussion ensued regarding the function of 'index' in the update feature.

5

63
4mo

Understanding Vector Naming in Typesense

Koushik was confused by inconsistent vector naming in Typesense documents. Jason clarified that the vector can be named anything, as long as it has a 'num_dim' property.

7
4mo