Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 500 when vector search w/ no limit #1700

Closed
toptobes opened this issue Nov 13, 2024 · 3 comments · Fixed by #1706
Closed

HTTP 500 when vector search w/ no limit #1700

toptobes opened this issue Nov 13, 2024 · 3 comments · Fixed by #1706
Assignees
Labels
Bug Something isn't working

Comments

@toptobes
Copy link

toptobes commented Nov 13, 2024

When doing a table.find({}, { sort: { vector: ... } }) on an indexed vector column w/out an explicit limit set:

DataAPIHttpError: HTTP error (500):

{
  "data":{"documents":[],"nextPageState":null},
  "status":{"sortVector":[1.0,1.0,1.0,1.0,1.0]},
  "errors":[{"message":"An unexpected server error occurred while processing the request. \n\nError Class: InvalidQueryException\nError Message: Use of ANN OF in an ORDER BY clause requires a LIMIT that is not greater than 1000. LIMIT was NO LIMIT","scope":"","errorCode":"UNEXPECTED_SERVER_ERROR","id":"f00d2d83-3c13-4f4f-bfe4-b0c5fb8bdeeb","family":"SERVER","title":"Unexpected server error"}]
}
@amorton
Copy link
Contributor

amorton commented Nov 13, 2024

It is the same API Command object as used in Collections, so it should have the default, so something is wrong in the way we are setting the limit for the FindCommandResolver in this case.

Repo:

{
    "find": {
        "filter": {"key": "doc 1"},
        "sort": 
            {
                "comment_vector": [0.45, 0.09, 0.01, 0.2, 0.11]
            }
    }
}
{
    "data": {
        "documents": [],
        "nextPageState": null
    },
    "errors": [
        {
            "message": "An unexpected server error occurred while processing the request. \n\nError Class: InvalidQueryException\nError Message: Use of ANN OF in an ORDER BY clause requires a LIMIT that is not greater than 1000. LIMIT was NO LIMIT",
            "scope": "",
            "errorCode": "UNEXPECTED_SERVER_ERROR",
            "id": "c7b30bbd-9746-4205-ab0b-b5b6246481d6",
            "family": "SERVER",
            "title": "Unexpected server error"
        }
    ]
}

@amorton amorton added the Bug Something isn't working label Nov 13, 2024
@amorton
Copy link
Contributor

amorton commented Nov 13, 2024

CQL that ran:

SELECT comment_vector,comment,key FROM demo.vector_5 WHERE key=? ORDER BY comment_vector ANN OF [0.45, 0.09, 0.01, 0.2, 0.11, <vector<unknown> trimmed, log at trace to get full value>] LIMIT 2147483647, values=[doc 1]

@amorton
Copy link
Contributor

amorton commented Nov 13, 2024

Fix coming...

request

{
    "find": {
        "filter": {"key": "doc 1"},
        "sort": 
            {
                "comment_vector": [0.45, 0.09, 0.01, 0.2, 0.11]
            }
    }
}

response:

{
    "data": {
        "documents": [
            {
                "comment_vector": [
                    0.45,
                    0.09,
                    0.01,
                    0.2,
                    0.11
                ],
                "comment": "comment about cheese and monkeys",
                "key": "doc 1"
            }
        ],
        "nextPageState": null
    },
    "status": {
        "projectionSchema": {
            "comment_vector": {
                "type": "vector",
                "dimension": 5
            },
            "comment": {
                "type": "text"
            },
            "key": {
                "type": "text"
            }
        }
    }
}

cql

 cql=SELECT comment_vector,comment,key FROM demo.vector_5 WHERE key=? ORDER BY comment_vector ANN OF [0.45, 0.09, 0.01, 0.2, 0.11, <vector<unknown> trimmed, log at trace to get full value>] LIMIT 1000, values=[doc 1]

Uses same default as the collection code

amorton added a commit that referenced this issue Nov 13, 2024
using the same configured AN find limit as collections, which
is currently 1k
@amorton amorton self-assigned this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants