# KNN/ANN Search on a parent-child documents

**URL:** <https://discuss.elastic.co/t/knn-ann-search-on-a-parent-child-documents/347162>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [November 14, 2023, 7:50pm UTC](https://discuss.elastic.co/t/knn-ann-search-on-a-parent-child-documents/347162 "2023-11-14T19:50:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Senchok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senchok/32/122545_2.png) [@Senchok](https://discuss.elastic.co/u/Senchok)\
**Post date:** [November 14, 2023, 7:50pm UTC](https://discuss.elastic.co/t/knn-ann-search-on-a-parent-child-documents/347162/1 "2023-11-14T19:50:06Z")

</div>

We are trying to find a solution to indexing and retrieving documents as vectors.  
The idea is to index the paragraphs of the document as a child and the document to be the parent document (join solution).  
Is there another solution that can prevent the use of parent-child?  
In the end our goal is to retrieve a document based on a search text as vector (KNN/ANN) that matches one of the paragraphs but returns the original document.

Parent-Child (Join) Example -

Parent Document: "paragraph1 paragraph2 paragraph3"  
Child 1: "paragraph1"  
Child 2: "paragraph2"  
Child 3: "paragraph3"

All the child include the parent id and indexed as a vector.

---

<div class="post-metadata">

**Author:** ![Sean\_Story](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sean_story/32/69987_2.png) [@Sean\_Story](https://discuss.elastic.co/u/Sean_Story)\
**Post date:** [December 6, 2023, 7:50pm UTC](https://discuss.elastic.co/t/knn-ann-search-on-a-parent-child-documents/347162/2 "2023-12-06T19:50:08Z")

</div>

Hi @Senchok ,

We recently published a blog about just this topic (chunking) that you might find interesting. Check out: [Chunking Large Documents via Ingest pipelines plus nested vectors equals easy passage search — Elastic Search Labs](https://www.elastic.co/search-labs/blog/articles/chunking-via-ingest-pipelines)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 3, 2024, 7:51pm UTC](https://discuss.elastic.co/t/knn-ann-search-on-a-parent-child-documents/347162/3 "2024-01-03T19:51:04Z")

</div>

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