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

[DOC] Neural search does not support field vector_field #5056

Open
1 of 4 tasks
savanbthakkar opened this issue Sep 20, 2023 · 4 comments
Open
1 of 4 tasks

[DOC] Neural search does not support field vector_field #5056

savanbthakkar opened this issue Sep 20, 2023 · 4 comments
Assignees
Labels
1 - Backlog Issue: The issue is unassigned or assigned but not started neural-search

Comments

@savanbthakkar
Copy link

savanbthakkar commented Sep 20, 2023

What do you want to do?

  • Request a change to existing documentation
  • Add new documentation
  • Report a technical problem with the documentation
  • Other

Tell us about your request. Provide a summary of the request and all versions that are affected.
As per Neural search documentation page here, neural query can have this field called vector_field. However, running a search with this field causes this error:
[neural] query does not support [vector_field]

What other resources are available? Provide links to related issues, POCs, steps for testing, etc.
I didn't find any similar issues or much documentation around neural search query.
I have 3 vector fields for each document that I index. Think of a product with 3 description fields. When I query with a keyword, I want to query all 3 vector fields.
This is how my query looks like:

GET /my_index/_search
{
  "_source": {
        "exclude": [ "doc_description1_vector","doc_description2_vector","doc_description3_vector" ]
    },
  "size": 50,
  "query": {
    "bool": {
      "should": [
        {
          "neural": {
            "doc_description1_vector": {
              "query_text": "Tennis Racquet",
              "vector_field": "doc_description1_vector",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        },
        {
          "neural": {
            "doc_description2_vector": {
              "query_text": "Tennis Racquet",
              "vector_field": "doc_description2_vector",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        },
        {
          "neural": {
            "doc_description3_vector": {
              "query_text": "Tennis Racquet",
              "vector_field": "doc_description3_vector",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        }
      ]
    }
  }
}

And here is the response in OpenSearch Dashboard dev tools.

{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[neural] query does not support [vector_field]",
        "line": 13,
        "col": 31
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[13:31] [bool] failed to parse field [should]",
    "caused_by": {
      "type": "parsing_exception",
      "reason": "[neural] query does not support [vector_field]",
      "line": 13,
      "col": 31
    }
  },
  "status": 400
}
@savanbthakkar savanbthakkar changed the title [DOC] [DOC] Neural search does not support field vector_field Sep 20, 2023
@hdhalter
Copy link
Contributor

hdhalter commented Nov 7, 2023

@macohen - Is there someone that might be able to test this?

@hdhalter hdhalter added 1 - Backlog Issue: The issue is unassigned or assigned but not started and removed untriaged labels Nov 7, 2023
@macohen
Copy link
Contributor

macohen commented Nov 7, 2023

maybe @navneet1v or @vamshin?

@navneet1v
Copy link
Contributor

navneet1v commented Nov 7, 2023

Hi @savanbthakkar,

You don't need to specify the vector_field as a parameter. Here is the updated query below.

GET /my_index/_search
{
  "_source": {
        "exclude": [ "doc_description1_vector","doc_description2_vector","doc_description3_vector" ]
    },
  "size": 50,
  "query": {
    "bool": {
      "should": [
        {
          "neural": {
            "doc_description1_vector": {
              "query_text": "Tennis Racquet",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        },
        {
          "neural": {
            "doc_description2_vector": {
              "query_text": "Tennis Racquet",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        },
        {
          "neural": {
            "doc_description3_vector": {
              "query_text": "Tennis Racquet",
              "model_id": "rTuZqYoB1bvGnxqnUifN",
              "k": 30
            }
          }
        }
      ]
    }
  }
}

The general syntax of the query clauses in Opensearch is:

<QUERY_CLAUSE_NAME> : {
   <FIELD_NAME>: {
      <DIFFERENT_REQUIRED_PARAMETERS_KEY>: <VALUE>
   }
}

I hope this clarifies and resolves your issue. If this is not what you are seeing in documentation please let us know, we will fix the documentation.

@hdhalter
Copy link
Contributor

Hi @kolchfa-aws , tagging you for visibility, in case there is anything we can clarify in the documentation. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Backlog Issue: The issue is unassigned or assigned but not started neural-search
Projects
None yet
Development

No branches or pull requests

5 participants