# Child document is occasionally not searchable

**URL:** <https://discuss.elastic.co/t/child-document-is-occasionally-not-searchable/337240>\
**Category:** Elasticsearch\
**Created:** [June 29, 2023, 8:33pm UTC](https://discuss.elastic.co/t/child-document-is-occasionally-not-searchable/337240 "2023-06-29T20:33:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kved](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@kved](https://discuss.elastic.co/u/kved)\
**Post date:** [June 29, 2023, 8:33pm UTC](https://discuss.elastic.co/t/child-document-is-occasionally-not-searchable/337240/1 "2023-06-29T20:33:36Z")

</div>

Child documents are sometimes not searchable. I have a parent-child relationship where the mapping looks like

```auto
{
     "parent": {
           "id": "keyword",
           "name": "text"
     }
     "childId": "keyword",
     "childName": "text",
     "_join_field": {
           "type": "join",
           "relations": { "parentDoc": ["childDoc"] }
     }
}

```

I am then indexing the child document using the bulk API like so:

```auto
{"index":{"_index":"my_index","_id":"childId.2984947e-1588-4fd3-8518-a2e3f2d5398e:parentId.f832b55a-883f-442b-b3f2-492d428e8fa1","routing":"parentId.f832b55a-883f-442b-b3f2-492d428e8fa1"}}
{"name":"test child","childId":"childId.2984947e-1588-4fd3-8518-a2e3f2d5398e","_join_field":{"name":"childDoc","parent":"parentId.f832b55a-883f-442b-b3f2-492d428e8fa1"}}

```

and indexing the parent document using the bulk API like so:

```auto
{"index":{"_index":"my_index","_id":"parentId.f832b55a-883f-442b-b3f2-492d428e8fa1"}}
{"parent": {"id": "parentId.f832b55a-883f-442b-b3f2-492d428e8fa1", "name": "test parent"}}

```

The child document is not searchable at all using a term query like:

```auto
POST /my_index/_search
{
    "query": { 
        "term": {
             "childId": { "value": "childId.2984947e-1588-4fd3-8518-a2e3f2d5398e:parentId.f832b55a-883f-442b-b3f2-492d428e8fa1" }
       }
}

```

Or using a termvectors request like:

```auto
GET /my_index/_termvectors/childId.2984947e-1588-4fd3-8518-a2e3f2d5398e:parentId.f832b55a-883f-442b-b3f2-492d428e8fa1

```

However I am able to retrieve it using an ids query which is telling me that the document is stored, but not analyzed. I validated the mappings to ensure they match the document structure.

Also, this is only sometimes happening, and other times the child docs are indexed successfully and are able to be searched. Is there some limit to how many child documents can exist in an index and it just silently does not analyze? Is there something else I should look out for to ensure that the documents are getting analyzed?

I am using ES version 7.17.7

Thank you!

---

<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:** [July 27, 2023, 8:33pm UTC](https://discuss.elastic.co/t/child-document-is-occasionally-not-searchable/337240/2 "2023-07-27T20:33:55Z")

</div>

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