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

Support ignore_unmapped in knn query #1018

Closed
Firenze11 opened this issue Jul 28, 2023 · 1 comment
Closed

Support ignore_unmapped in knn query #1018

Firenze11 opened this issue Jul 28, 2023 · 1 comment
Assignees

Comments

@Firenze11
Copy link

Is your feature request related to a problem? Please describe.
I'm sending a knn query to a number of indices but they don't necessarily all have the knn field

GET my_index_prefix_*/_search
{"query": {"knn": {"embedding_256": {"k": 10, "vector": [......]}}}

fails with this error

      {
        "shard": 0,
        "index": "my_index_prefix_123456",
        "node": "xxxxxx",
        "reason": {
          "type": "query_shard_exception",
          "reason": "failed to create query: Field 'embedding_256' is not knn_vector type.",
          "index": "my_index_prefix_123456",
          "index_uuid": "xxxxxx",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Field 'embedding_256' is not knn_vector type."
          }
        }
      }

Describe the solution you'd like
Like nested types, knn types can also have an ignore_unmapped field, so I can search among only the indices with this knn field. The query would be like

GET my_index_prefix_*/_search
{"query": {"knn": {"embedding_256": {"k": 10, "vector": [......], "ignore_unmapped": true}}}

Describe alternatives you've considered
Force adding an empty knn field to all indices. But that is troublesome.

@dblock dblock transferred this issue from opensearch-project/OpenSearch Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants