diff --git a/docs/reference/search/search-your-data/knn-search.asciidoc b/docs/reference/search/search-your-data/knn-search.asciidoc index 496e0cf1b9d4f..a847d9a306b7c 100644 --- a/docs/reference/search/search-your-data/knn-search.asciidoc +++ b/docs/reference/search/search-your-data/knn-search.asciidoc @@ -814,12 +814,19 @@ Now we have filtered based on the top level `"creation_time"` and only one docum ---- // TESTRESPONSE[s/"took": 4/"took" : "$body.took"/] +[discrete] +[[nested-knn-search-inner-hits]] +==== Nested kNN Search with Inner hits + Additionally, if you wanted to extract the nearest passage for a matched document, you can supply <> to the `knn` clause. NOTE: `inner_hits` for kNN will only ever return a single hit, the nearest passage vector. Setting `"size"` to any value greater than `1` will have no effect on the results. +NOTE: When using `inner_hits` and multiple `knn` clauses, be sure to specify the <> +field. Otherwise, a naming clash can occur and fail the search request. + [source,console] ---- POST passage_vectors/_search