# Semantic search inner\_hits

**URL:** <https://forum.opensearch.org/t/semantic-search-inner-hits/27340>\
**Category:** k-NN\
**Created:** [October 22, 2025, 11:19am UTC](https://forum.opensearch.org/t/semantic-search-inner-hits/27340 "2025-10-22T11:19:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![faileon](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@faileon](https://forum.opensearch.org/u/faileon)\
**Post date:** [October 22, 2025, 11:19am UTC](https://forum.opensearch.org/t/semantic-search-inner-hits/27340/1 "2025-10-22T11:19:54Z")

</div>

**Versions** v 3.1.0

When I run pure semantic search with dense vectors via neural query and with nested documents, the inner\_hits only contain one result.

Example:

```json
GET my_index/_search
{
  "query": {
    "nested": {
      "path": "embeddings",
      "query": {
        "neural": {
          "embeddings.embedding": {
            "query_text": "What is foo bar baz?",
            "model_id": "model_id",
            "k": 5
          }
        }
      },
      "inner_hits": {
        "size": 5,
        "_source": [
          "embeddings.text"
        ]
      }
    }
  }
}

```

The `inner_hits` will only contain 1 chunk per document, not respecting the size parameter.

When I however run this with hybrid search, the size parameter of inner\_hit is respected:

```json
GET my_index/_search?search_pipeline=minmax-pipeline
{
  "query": {
    "hybrid": {
      "queries": [
        {
          "nested": {
            "path": "embeddings",
            "query": {
              "match": {
                "embeddings.text": {
                  "query": "What is foo bar baz?"
                }
              }
            },
            "inner_hits": {
              "size": 5,
              "_source": [
                "embeddings.text"
              ]
            }
          }
        },
        {
          "nested": {
            "path": "embeddings",
            "query": {
              "neural": {
                "embeddings.embedding": {
                  "query_text": "What is foo bar baz?",
                  "model_id": "model_id",
                  "k": 5
                }
              }
            }
          }
        }
      ]
    }
  }
}

```

Is there a way to get more `inner_hits` result from the semantic search?

I am running into a scenario now where there are multiple chunks in the first parent document, which have better scores than the winning chunk in second parent document. Which means I am losing context.

---

<div class="post-metadata">

**Author:** ![faileon](https://avatars.discourse-cdn.com/v4/letter/f/f17d59/32.png) [@faileon](https://forum.opensearch.org/u/faileon)\
**Post date:** [October 22, 2025, 11:34am UTC](https://forum.opensearch.org/t/semantic-search-inner-hits/27340/2 "2025-10-22T11:34:01Z")

</div>

And just as I ask the question, I find the `"expand_nested_docs": true` in the [docs](https://docs.opensearch.org/latest/query-dsl/specialized/neural/#request-body-fields)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [December 21, 2025, 11:34am UTC](https://forum.opensearch.org/t/semantic-search-inner-hits/27340/3 "2025-12-21T11:34:36Z")

</div>

Closed on December 21, 2025, 11:34am UTC

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