#22823·OpenSearch

[BUG] Hybrid query different total.value on different sizes on 3.x versions

Author: Treno1Created Aug 24, 2026Updated Sep 30, 2026
LabelsbugSearch

Describe the bug

When wrapping simple match clause into hybrid query with low size, hits.total.value is different than in plain match query.

In example I have test index with simple text field, match by word returns hits.total.value 933 with any size param If I wrap it into hybrid.queries and call it with size lower than 737, hits.total.value = 761 If I ran same hybrid query with size 737 or higher, total.value is correct (933).

Also first three documents in hybrid query in hits are the same but with different scores

Related component

Search

To Reproduce

  1. Create OpenSearch 3.8.0 instance
bash
podman run -d \
--name opensearch-3-8 \
-p 9203:9200 \
-p 9603:9600 \
-e "discovery.type=single-node" \
-e "DISABLE_SECURITY_PLUGIN=true" \
docker.io/opensearchproject/opensearch:3.8.0
  1. Run this script to create lorem_idx index with 5000 documents(python3 create_lorem_idx.py --host localhost --port 9203) create_lorem_idx.py
  2. Run this query to get correct hits.total.value (933 for me)
bash
curl --request POST \
  --url http://localhost:9203/lorem_idx/_search \
  --H 'Content-Type: application/json' \
  --d '
{
    "from": 0,
    "query": {
        "match": {
            "text": "dolor"
        }
    },
    "size": 10,
    "_source": false
}'
  1. Run this query to see lower hits.total.value (737 for me)
bash
curl --request POST \
  --url http://localhost:9203/lorem_idx/_search \
  --H 'Content-Type: application/json' \
  --d '
{
    "from": 0,
    "query": {
        "hybrid": {
            "queries": [
                {
                    "match": {
                        "text": "dolor"
                    }
                }
            ]
        }
    },
    "size": 10,
    "_source": false
}'
  1. Run query with higher size, to see correct hits.total.value (933 for me)
bash
curl --request POST \
  --url http://localhost:9203/lorem_idx/_search \
  --H 'Content-Type: application/json' \
  --d '
{
    "from": 0,
    "query": {
        "hybrid": {
            "queries": [
                {
                    "match": {
                        "text": "dolor"
                    }
                }
            ]
        }
    },
    "size": 10000,
    "_source": false
}'

hits.total.value from second query (step 4) is different from first and third query (step 3 and 5).

Expected behavior

  1. hits.total.value should be the same for any size for hybrid query.
  2. All hits.total.value from each of these queries should be equal.
  3. First document should not be duplicated in hybrid query response

Additional Details

Screenshots First response (from step 3) First response Second response (from step 4) Second response Third response (from step 5) Third response

Host/Environment (please complete the following information):

  • OS: [MacOS Tahoe 26.3.1, Amazon OpenSearch Service in production ]
  • Versions [3.5, 3.6, 3.7, 3.8]

Additional context I found this issue when upgraded from 2.19 to 3.5 version in Amazon OpenSearch Service. Reproduced it locally on 3.5, 3.6, 3.7 and 3.8 versions I know that you are not supposed to run hybrid query with one subquery inside, but I had it with two queries (knn + multimatch) in production. Narrowed it down to this simple example

Source: opensearch-project/OpenSearch