# Full text search on both Parent and Child

**URL:** https://discuss.elastic.co/t/full-text-search-on-both-parent-and-child/289990
**Category:** Elasticsearch
**Created:** [November 23, 2021, 10:20pm UTC](https://discuss.elastic.co/t/full-text-search-on-both-parent-and-child/289990 "2021-11-23T22:20:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![annasunny](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@annasunny](https://discuss.elastic.co/u/annasunny)
#### Post date: [November 23, 2021, 10:20pm UTC](https://discuss.elastic.co/t/full-text-search-on-both-parent-and-child/289990/1 "2021-11-23T22:20:14Z")

</div>

Hi,  
I'm looking for a query ( or multiple queries) to do a full text search on both Parent and Child. Thank you in advance!  
I'm using the parent-child type. For example, my Parent documents will be a Choice, and its structure looks like:

```auto
{
    "id": "choiceId"
     "brand": "Nike"
 }

```

My Child data will be Item, and Item is associated to its parent id

```auto
{
      "id": "itemId-1",
      "attributes": {
        "color": "blue",
        "size": "medium"
      },
      "_parent":"choiceId"
}

```

```auto
{
      "id": "itemId-2",
      "attributes": {
        "color": "red",
        "size": "large"
      },
     "_parent":"choiceId"
} 

```

Here is the mapping:

```auto
{
  "mappings": {
    "_doc": {
      "properties": {
        "parent": { 
          "type": "join",
          "relations": {
            "choice": "item" 
          }
        }
      }
    }
  }
}

```

The full text search query will be "Nike red large". So I need to return the matched Parent who can match the search query(need to match every word within the search query) on itself and any of its Child (Children).  
I'm not able to find a search query ( or multiple queries) to do a full text search on both Parent and Child. Could anyone help? Thanks!

---

<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: [December 21, 2021, 10:20pm UTC](https://discuss.elastic.co/t/full-text-search-on-both-parent-and-child/289990/2 "2021-12-21T22:20:14Z")

</div>

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