# Adding \_source field to IndexResponse

**URL:** https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261
**Category:** Elasticsearch
**Created:** [November 16, 2016, 2:34pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261 "2016-11-16T14:34:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zillion582](https://avatars.discourse-cdn.com/v4/letter/z/51bf81/32.png) [@zillion582](https://discuss.elastic.co/u/zillion582)
#### Post date: [November 16, 2016, 2:34pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261/1 "2016-11-16T14:34:38Z")

</div>

Is there a way in the java API to customize the returned IndexResponse (And indexresponses within a BulkResponse) such that the response contains one of the \_source fields?

Based on the response here [Get certain fields in bulk API response](https://discuss.elastic.co/t/get-certain-fields-in-bulk-api-response/23408) it seems like it should be possible, but I was unable to determine how.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 16, 2016, 2:57pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261/2 "2016-11-16T14:57:53Z")

</div>

I don't believe you can OOTB.  
As mentioned in the thread you linked to, it's easier to call the GET API after that?

Wondering why do you need that after all? Actually you are sending the document you want to index, right? Why reading that again?  
Does it relate somehow with ingest node processing?

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [November 16, 2016, 3:09pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261/3 "2016-11-16T15:09:24Z")

</div>

> [@dadoonet](#):
>
> As mentioned in the thread you linked to, it's easier to call the GET API after that?

Calling get right after an index in 5.0 is going to cause a refresh to support the realtime get which is probably not a good thing to do consistently.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 16, 2016, 3:23pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261/4 "2016-11-16T15:23:36Z")

</div>

> [@nik9000](#):
>
> which is probably not a good thing to do consistently.

Very true! I forgot about this one! 🙂 Thanks Nik!

---

<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 14, 2016, 3:23pm UTC](https://discuss.elastic.co/t/adding--source-field-to-indexresponse/66261/5 "2016-12-14T15:23:43Z")

</div>

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