Skip to content

Commit

Permalink
Update nested knn search documentation about inner-hits (#104154) (#1…
Browse files Browse the repository at this point in the history
…04202)

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.
  • Loading branch information
benwtrent authored Jan 10, 2024
1 parent d0fb429 commit fb3d545
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/reference/search/search-your-data/knn-search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<inner-hits, inner_hits>>
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 <<inner-hits-options,`inner_hits.name`>>
field. Otherwise, a naming clash can occur and fail the search request.

[source,console]
----
POST passage_vectors/_search
Expand Down

0 comments on commit fb3d545

Please sign in to comment.