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

[BUG] Should not allow the hybrid query to be wrapped by another hybrid query. #1108

Open
bzhangam opened this issue Jan 15, 2025 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers hybrid search

Comments

@bzhangam
Copy link
Contributor

What is the bug?

The hybrid query should be the top query but we miss the validation for the case that a hybrid query can be wrapped by another hybrid query.

How can one reproduce the bug?

  1. Follow this doc to set up the hybrid search.
  2. Do query like below:
   "_source":{
      "excludes":[
         "passage_embedding"
      ]
   },
   "query":{
      "hybrid":{
         "queries":[
            {
               "hybrid":{
                  "queries":[
                     {
                        "neural":{
                           "passage_embedding":{
                              "query_text":"wild west",
                              "model_id":"<your_model_id>",
                              "k":2
                           }
                        }
                     },
                     {
                        "match_phrase":{
                           "id":"1775029934.jpg"
                        }
                     }
                  ]
               }
            },
            {
               "match_phrase":{
                  "id":"1775029934.jpg"
               }
            }
         ]
      }
   }
}`

### What is the expected behavior?
We should see an error saying the hybrid query should be the top query and cannot be nested in another hybrid query.

### What is your host/environment?
OS: macOS v15.2
OpenSearch: main branch code

### Do you have any screenshots?
N/A

### Do you have any additional context?
N/A
@bzhangam bzhangam added bug Something isn't working untriaged labels Jan 15, 2025
@martin-gaievski
Copy link
Member

martin-gaievski commented Jan 15, 2025

+1 to this, for reference this is the issue when the initial check was added #498. I think this scenario was missing in that initial PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers hybrid search
Projects
None yet
Development

No branches or pull requests

3 participants