# Has\_parent empty

**URL:** <https://discuss.elastic.co/t/has-parent-empty/87413>\
**Category:** Elasticsearch\
**Created:** [May 29, 2017, 8:12am UTC](https://discuss.elastic.co/t/has-parent-empty/87413 "2017-05-29T08:12:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stijn\_Van\_Hulle](https://avatars.discourse-cdn.com/v4/letter/s/7993a0/32.png) [@Stijn\_Van\_Hulle](https://discuss.elastic.co/u/Stijn_Van_Hulle)\
**Post date:** [May 29, 2017, 8:12am UTC](https://discuss.elastic.co/t/has-parent-empty/87413/1 "2017-05-29T08:12:06Z")

</div>

Hello, i'm having problems with the parent-child relation. I did both post/put and got a ack true back.

PUT /capsules/collections/vBDpjJTuspSLkZjeT?parent=S7iubdumqyfLKdLBK  
{  
"userId": "vgcbygqqebq5LtZtc",  
"capsuleId": "S7iubdumqyfLKdLBK",  
"capsuleQty": 1,  
"id": "vBDpjJTuspSLkZjeT"  
}

PUT /capsules/capsules/S7iubdumqyfLKdLBK?routing=S7iubdumqyfLKdLBK  
{  
"type": "GENERIC",  
"number": "871",  
"addition": "e",  
"value": 1,  
"description": "Champagne",  
"inOwnerCollection": true,  
"quantity": 1,  
"ownerId": "vgcbygqqebq5LtZtc",  
"approvalState": "APPROVED",  
"createdAt": "2016-11-01T06:38:04.789Z",  
"imagePath": "/uploads/capsules/S7iubdumqyfLKdLBK/capsule\_image.jpg",  
"\_number": 871,  
"id": "S7iubdumqyfLKdLBK",  
"farmerId":null  
}

When doing a must not of has-parent i got this, parent is set but has parent didn't found it.  
"hits": {  
"total": 11700,  
"max\_score": null,  
"hits": [  
{  
"\_index": "capsules",  
"\_type": "collections",  
"\_id": "vBDpjJTuspSLkZjeT",  
"\_score": null,  
"\_routing": "vBDpjJTuspSLkZjeT",  
"\_parent": "S7iubdumqyfLKdLBK",  
"\_source": {  
"userId": "vgcbygqqebq5LtZtc",  
"capsuleId": "S7iubdumqyfLKdLBK",  
"capsuleQty": 1,  
"id": "vBDpjJTuspSLkZjeT",  
"value": null  
},  
"sort": [  
null  
]  
},

Alspo my mapping and settings:  
{  
"capsules": {  
"aliases": {},  
"mappings": {  
"capsules": {  
"\_parent": {  
"type": "farmers"  
},  
"\_routing": {  
"required": true  
},  
"properties": {  
"\_farmerName": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"\_number": {  
"type": "long",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"addition": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"approvalState": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"createdAt": {  
"type": "date",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"description": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"farmerId": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"farmerName": {  
"type": "text"  
},  
"id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"imagePath": {  
"type": "text"  
},  
"inOwnerCollection": {  
"type": "boolean"  
},  
"number": {  
"type": "text"  
},  
"ownerId": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"quantity": {  
"type": "long"  
},  
"tradeValue": {  
"type": "float"  
},  
"type": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"value": {  
"type": "long"  
}  
}  
},  
"farmers": {  
"properties": {  
"capsuleCount": {  
"type": "long",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"createdAt": {  
"type": "date"  
},  
"id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"name": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"owner": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
}  
}  
},  
"collections": {  
"\_parent": {  
"type": "capsules"  
},  
"\_routing": {  
"required": true  
},  
"properties": {  
"capsuleId": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"capsuleQty": {  
"type": "long",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
},  
"userId": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword"  
}  
}  
}  
}  
}  
},  
"settings": {  
"index": {  
"creation\_date": "1496039760268",  
"number\_of\_shards": "5",  
"number\_of\_replicas": "1",  
"uuid": "uTDUnIiARbyMnld4HF9srw",  
"version": {  
"created": "5010199"  
},  
"provided\_name": "capsules"  
}  
}  
}  
}

---

<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:** [June 26, 2017, 8:12am UTC](https://discuss.elastic.co/t/has-parent-empty/87413/2 "2017-06-26T08:12:49Z")

</div>

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