# Elasticsearch query not returning document source

**URL:** <https://discuss.elastic.co/t/elasticsearch-query-not-returning-document-source/38383>\
**Category:** Elasticsearch\
**Created:** [January 5, 2016, 8:09am UTC](https://discuss.elastic.co/t/elasticsearch-query-not-returning-document-source/38383 "2016-01-05T08:09:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarathrs](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@sarathrs](https://discuss.elastic.co/u/sarathrs)\
**Post date:** [January 5, 2016, 8:09am UTC](https://discuss.elastic.co/t/elasticsearch-query-not-returning-document-source/38383/1 "2016-01-05T08:09:12Z")

</div>

Hi,

I have an index 'company' with types 'branch', 'employee' (Names of index and types are changed from the real). Cluster has 5 primary shards, 1 replica. Type 'branch' has 276 records and in 'employee' type we have 5 records.

Refer mapping and query in the gist : [https://gist.github.com/sarathrs/027a23da49a67c1ada2f](https://gist.github.com/sarathrs/027a23da49a67c1ada2f)

When i execute the query, source of the documents are not returned. Can someone explain why it is behaving so. Interestingly if i remove script\_score from function\_score query in should clause then query returns source.

Out of 276 records in type 'branch' query matches for 2 documents. must clause matches for 2 documents and should clause matches for 1 document

Thanks,  
Sarath

---

<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 5, 2017, 11:27pm UTC](https://discuss.elastic.co/t/elasticsearch-query-not-returning-document-source/38383/2 "2017-07-05T23:27:06Z")

</div>

Closed on July 5, 2017, 11:27pm UTC


