Help Needed: Correct Syntax for Filters in Hybrid Search Subqueries

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
opensearch-2.11.1

Describe the issue:
Hello OpenSearch Community,

I’m working on implementing a hybrid search in OpenSearch and encountering some difficulties with the correct syntax for filters in my subqueries. Below is my current query structure:

{
    "query": {
        "hybrid": {
            "queries": [
                {
                    "bool": {
                        "should": [
                            {
                                "multi_match": {
                                    "query": "solar",
                                    "type": "most_fields",
                                    "fields": [
                                        "og_title^3",
                                        "og_description^2",
                                        "name^2",
                                        "href_filename^2",
                                        "content"
                                    ]
                                }
                            }
                        ],
                        "filter": [
                            {
                                "term": {
                                    "content_type": "text"
                                }
                            }
                        ]
                    }
                },
                {
                    "bool": {
                        "should": [
                            {
                                "neural": {
                                    "embedding": {
                                        "query_text": "solar",
                                        "model_id": "LTZ1F40B3USp5Eb6uqGR",
                                        "k": 5
                                    }
                                }
                            }
                        ],
                        "filter": [
                            {
                                "term": {
                                    "content_type": "text"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "size": "10",
    "_source": {
        "excludes": [
            "embedding"
        ]
    }
}

While executing this query, I’m facing the following error:

TransportError(500, 'search_phase_execution_exception', 'Index 1 out of bounds for length 1')

I’m not sure if this is due to a syntax error in my query or a more complex issue. Any guidance on the correct syntax for filters in hybrid search subqueries or insights into this error would be greatly appreciated.

Thank you in advance for your help!

Configuration:

Relevant Logs or Screenshots:

Hey, this isn’t relevant to your issue. However, since it’s been a few days without a response to your query, I would like to use this space to inquire whether the Machine Learning models, such as those on Hugging Face, are responding for you. The ML dashboard shows as not responding for some reason on my end, and since hybrid search requires an ML model, I’m curious if you had experienced any such issue. Currently, I’m testing the functionality using the inbuilt dev tools of OpenSearch.

Hi Ulan,

Can you please provide more information regarding you initial request:

  • mapping for fields mentioned in your query (or full mapping for index if that’s easier)
  • what’s your index/cluster setup - how many shard, replicas, nodes
  • is it possible to simplify the query, in other words - the simplest query that has the same issue
  • what model do you use? is it hosted locally or remotely?
  • how many documents in your index

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.