From fb3d5456906680dad67a56de9502e74ff30785f9 Mon Sep 17 00:00:00 2001 From: Benjamin Trent Date: Wed, 10 Jan 2024 08:08:24 -0500 Subject: [PATCH] Update nested knn search documentation about inner-hits (#104154) (#104202) Adding a link tag for inner hits behavior and kNN search. Additionally adding a note that if you are using multiple knn clauses, that the inner hit name should be provided. --- docs/reference/search/search-your-data/knn-search.asciidoc | 7 +++++++ 1 file changed, 7 insertions(+) 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