# Getting \_source of each hit

**URL:** <https://discuss.elastic.co/t/getting--source-of-each-hit/3432>\
**Category:** Elasticsearch\
**Created:** [October 11, 2010, 6:17pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432 "2010-10-11T18:17:10Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ted\_Karmel](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Ted\_Karmel](https://discuss.elastic.co/u/Ted_Karmel)\
**Post date:** [October 11, 2010, 6:17pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/1 "2010-10-11T18:17:10Z")

</div>

Pardon for bringing this up again as I remember reading a post on the  
mailing list about this. But, I can't seem to find it again.

Basically, I just would like to get the \_source of each hit (e.g. the  
original json document that was sent). I think it is doable via  
scripts / filters.

I would appreciate anybody pointing me in the right direction or  
including a sample code line.

Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 11, 2010, 6:23pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/2 "2010-10-11T18:23:24Z")

</div>

This is what you get by default when you search (for example, with just a  
query). Do you not get it back?

On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Pardon for bringing this up again as I remember reading a post on the  
> mailing list about this. But, I can't seem to find it again.
> 
> Basically, I just would like to get the \_source of each hit (e.g. the  
> original json document that was sent). I think it is doable via  
> scripts / filters.
> 
> I would appreciate anybody pointing me in the right direction or  
> including a sample code line.
> 
> Thanks.

---

<div class="post-metadata">

**Author:** ![Ted\_Karmel](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Ted\_Karmel](https://discuss.elastic.co/u/Ted_Karmel)\
**Post date:** [October 11, 2010, 7:27pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/3 "2010-10-11T19:27:50Z")

</div>

Sorry for not being specific. What I meant is only getting the  
\_source of each hit directly (without the contextual information like  
\_index \_type \_id etc... ).

On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> This is what you get by default when you search (for example, with just a  
> query). Do you not get it back?
> 
> On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:
> 
> > Pardon for bringing this up again as I remember reading a post on the  
> > mailing list about this. But, I can't seem to find it again.
> > 
> > Basically, I just would like to get the \_source of each hit (e.g. the  
> > original json document that was sent). I think it is doable via  
> > scripts / filters.
> > 
> > I would appreciate anybody pointing me in the right direction or  
> > including a sample code line.
> > 
> > Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 11, 2010, 7:30pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/4 "2010-10-11T19:30:17Z")

</div>

Not sure I understand.., what do you mean directly? Do you want to get it as  
part of a search response for each hit? Do you maybe want to get just part  
of the \_source? Maybe an example would help...

On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Sorry for not being specific. What I meant is only getting the  
> \_source of each hit directly (without the contextual information like  
> \_index \_type \_id etc... ).
> 
> On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > This is what you get by default when you search (for example, with just a  
> > query). Do you not get it back?
> > 
> > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > wrote:
> > 
> > > Pardon for bringing this up again as I remember reading a post on the  
> > > mailing list about this. But, I can't seem to find it again.
> > > 
> > > Basically, I just would like to get the \_source of each hit (e.g. the  
> > > original json document that was sent). I think it is doable via  
> > > scripts / filters.
> > > 
> > > I would appreciate anybody pointing me in the right direction or  
> > > including a sample code line.
> > > 
> > > Thanks.

---

<div class="post-metadata">

**Author:** ![Ted\_Karmel](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Ted\_Karmel](https://discuss.elastic.co/u/Ted_Karmel)\
**Post date:** [October 11, 2010, 8:19pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/5 "2010-10-11T20:19:04Z")

</div>

Sure.

Ok, I will provide the response I get for a search in sample 1. I  
will provide what I would like to get in sample 2.

I search via URL parameters :

[http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)

Thanks in advance for taking a look.

Sample 1 :

{"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
"\_source" : {  
"user" : "yoyo",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "Elastic is fun"  
}},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
"\_source" : {  
"user" : "bulgogi",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "Elastic Search is cool"  
}},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
"\_source" : {  
"user" : "kimchy",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "trying out Elastic Search"  
}}]}}

Sample 2 :

[{  
"user" : "yoyo",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "Elastic is fun"  
}, {  
"user" : "bulgogi",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "Elastic Search is cool"  
}, {  
"user" : "kimchy",  
"postDate" : "2009-11-15T14:12:12",  
"message" : "trying out Elastic Search"  
}]

On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Not sure I understand.., what do you mean directly? Do you want to get it as  
> part of a search response for each hit? Do you maybe want to get just part  
> of the \_source? Maybe an example would help...
> 
> On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:
> 
> > Sorry for not being specific. What I meant is only getting the  
> > \_source of each hit directly (without the contextual information like  
> > \_index \_type \_id etc... ).
> > 
> > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > This is what you get by default when you search (for example, with just  
> > > a  
> > > query). Do you not get it back?
> > > 
> > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > wrote:
> > > 
> > > > Pardon for bringing this up again as I remember reading a post on the  
> > > > mailing list about this. But, I can't seem to find it again.
> > > > 
> > > > Basically, I just would like to get the \_source of each hit (e.g. the  
> > > > original json document that was sent). I think it is doable via  
> > > > scripts / filters.
> > > > 
> > > > I would appreciate anybody pointing me in the right direction or  
> > > > including a sample code line.
> > > > 
> > > > Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 11, 2010, 8:23pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/6 "2010-10-11T20:23:38Z")

</div>

I see now. So you just want an array of source results, without any meta  
information for the response? This means that there won't be places to put  
facets results for example, as well as no indication where a result came  
from and if it (partially) failed or not. Can I ask why you want this? Can't  
it be done it be transformed to the format you want up the stack from  
elasticsearch?

On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Sure.
> 
> Ok, I will provide the response I get for a search in sample 1. I  
> will provide what I would like to get in sample 2.
> 
> I search via URL parameters :
> 
> [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> 
> Thanks in advance for taking a look.
> 
> Sample 1 :
> 
> {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
> "\_source" : {  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
> "\_source" : {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
> "\_source" : {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }}]}}
> 
> Sample 2 :
> 
> [{  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"  
> }, {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"  
> }, {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }]
> 
> On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Not sure I understand.., what do you mean directly? Do you want to get it  
> > as  
> > part of a search response for each hit? Do you maybe want to get just  
> > part  
> > of the \_source? Maybe an example would help...
> > 
> > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > wrote:
> > 
> > > Sorry for not being specific. What I meant is only getting the  
> > > \_source of each hit directly (without the contextual information like  
> > > \_index \_type \_id etc... ).
> > > 
> > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > This is what you get by default when you search (for example, with  
> > > > just  
> > > > a  
> > > > query). Do you not get it back?
> > > > 
> > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Pardon for bringing this up again as I remember reading a post on the  
> > > > > mailing list about this. But, I can't seem to find it again.
> > > > > 
> > > > > Basically, I just would like to get the \_source of each hit (e.g. the  
> > > > > original json document that was sent). I think it is doable via  
> > > > > scripts / filters.
> > > > > 
> > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > including a sample code line.
> > > > > 
> > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![Ted\_Karmel](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Ted\_Karmel](https://discuss.elastic.co/u/Ted_Karmel)\
**Post date:** [October 11, 2010, 9:21pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/7 "2010-10-11T21:21:00Z")

</div>

Yes. It can absolutely be transformed in another part of the stack.  
But, I am minimally inclined and think that systems should be data  
led. The rest of the stack really is just middleware that can be  
whittled down.

I find that the vast majority of the requests I make do not really  
need meta information. A client rarely needs meta information  
displayed. The id / location of the document is not necessary unless  
you are editing the document. And I mostly write or read. And my  
requests are quite fault-tolerant. In that context, I would just like  
that simple json format to be the default for my responses as that is  
what I need the majority of the time.

I can of course edit the results down each time. I just thought,  
perhaps mistakenly, that Elasticsearch had this capability.

On Mon, Oct 11, 2010 at 9:23 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> I see now. So you just want an array of source results, without any meta  
> information for the response? This means that there won't be places to put  
> facets results for example, as well as no indication where a result came  
> from and if it (partially) failed or not. Can I ask why you want this? Can't  
> it be done it be transformed to the format you want up the stack from  
> elasticsearch?
> 
> On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:
> 
> > Sure.
> > 
> > Ok, I will provide the response I get for a search in sample 1. I  
> > will provide what I would like to get in sample 2.
> > 
> > I search via URL parameters :
> > 
> > [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> > 
> > Thanks in advance for taking a look.
> > 
> > Sample 1 :
> > 
> > {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
> > "\_source" : {  
> > "user" : "yoyo",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "Elastic is fun"
> > 
> > }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
> > "\_source" : {  
> > "user" : "bulgogi",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "Elastic Search is cool"
> > 
> > }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
> > "\_source" : {  
> > "user" : "kimchy",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "trying out Elastic Search"  
> > }}]}}
> > 
> > Sample 2 :
> > 
> > [{  
> > "user" : "yoyo",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "Elastic is fun"  
> > }, {  
> > "user" : "bulgogi",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "Elastic Search is cool"  
> > }, {  
> > "user" : "kimchy",  
> > "postDate" : "2009-11-15T14:12:12",  
> > "message" : "trying out Elastic Search"  
> > }]
> > 
> > On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > Not sure I understand.., what do you mean directly? Do you want to get  
> > > it as  
> > > part of a search response for each hit? Do you maybe want to get just  
> > > part  
> > > of the \_source? Maybe an example would help...
> > > 
> > > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > wrote:
> > > 
> > > > Sorry for not being specific. What I meant is only getting the  
> > > > \_source of each hit directly (without the contextual information like  
> > > > \_index \_type \_id etc... ).
> > > > 
> > > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > 
> > > > > This is what you get by default when you search (for example, with  
> > > > > just  
> > > > > a  
> > > > > query). Do you not get it back?
> > > > > 
> > > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Pardon for bringing this up again as I remember reading a post on  
> > > > > > the  
> > > > > > mailing list about this. But, I can't seem to find it again.
> > > > > > 
> > > > > > Basically, I just would like to get the \_source of each hit (e.g.  
> > > > > > the  
> > > > > > original json document that was sent). I think it is doable via  
> > > > > > scripts / filters.
> > > > > > 
> > > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > > including a sample code line.
> > > > > > 
> > > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 11, 2010, 10:49pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/8 "2010-10-11T22:49:47Z")

</div>

Yea, I know what you mean. I personally very much like what I call the "Mr.  
Miyagi" architecture (JSON IN, JSON OUT).

Elasticsearch does not have the ability you want. The ability to search  
across types / indices is used by several users, and then it does make sense  
to return that information (not to mention facets and others). Adding this  
as an option opens a dangerous path, where people will want different  
formats and different aspects of what to return, which means that  
implementing something like "curl -XGET  
host:9200/\_search?format=no\_index\_no\_type\_just\_array\_of\_sources" is not the  
right solution to the problem (exaggerating here a bit, but it can lead to  
that 🙂 ).

I have some ideas on how to maybe help to create such a feature. But its a  
bit down the road, and requires some previous features / foundation to be  
built (hint, it has to do with all those scripting lang support I have been  
adding lately 😉 ).

-shay.banon

On Mon, Oct 11, 2010 at 11:21 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Yes. It can absolutely be transformed in another part of the stack.  
> But, I am minimally inclined and think that systems should be data  
> led. The rest of the stack really is just middleware that can be  
> whittled down.
> 
> I find that the vast majority of the requests I make do not really  
> need meta information. A client rarely needs meta information  
> displayed. The id / location of the document is not necessary unless  
> you are editing the document. And I mostly write or read. And my  
> requests are quite fault-tolerant. In that context, I would just like  
> that simple json format to be the default for my responses as that is  
> what I need the majority of the time.
> 
> I can of course edit the results down each time. I just thought,  
> perhaps mistakenly, that Elasticsearch had this capability.
> 
> On Mon, Oct 11, 2010 at 9:23 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > I see now. So you just want an array of source results, without any meta  
> > information for the response? This means that there won't be places to  
> > put  
> > facets results for example, as well as no indication where a result came  
> > from and if it (partially) failed or not. Can I ask why you want this?  
> > Can't  
> > it be done it be transformed to the format you want up the stack from  
> > elasticsearch?
> > 
> > On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > wrote:
> > 
> > > Sure.
> > > 
> > > Ok, I will provide the response I get for a search in sample 1. I  
> > > will provide what I would like to get in sample 2.
> > > 
> > > I search via URL parameters :
> > > 
> > > [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> > > 
> > > Thanks in advance for taking a look.
> > > 
> > > Sample 1 :
> 
> {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,
> 
> > > "\_source" : {  
> > > "user" : "yoyo",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "Elastic is fun"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,
> 
> > > "\_source" : {  
> > > "user" : "bulgogi",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "Elastic Search is cool"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,
> 
> > > "\_source" : {  
> > > "user" : "kimchy",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "trying out Elastic Search"  
> > > }}]}}
> > > 
> > > Sample 2 :
> > > 
> > > [{  
> > > "user" : "yoyo",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "Elastic is fun"  
> > > }, {  
> > > "user" : "bulgogi",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "Elastic Search is cool"  
> > > }, {  
> > > "user" : "kimchy",  
> > > "postDate" : "2009-11-15T14:12:12",  
> > > "message" : "trying out Elastic Search"  
> > > }]
> > > 
> > > On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > Not sure I understand.., what do you mean directly? Do you want to get  
> > > > it as  
> > > > part of a search response for each hit? Do you maybe want to get just  
> > > > part  
> > > > of the \_source? Maybe an example would help...
> > > > 
> > > > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Sorry for not being specific. What I meant is only getting the  
> > > > > \_source of each hit directly (without the contextual information like  
> > > > > \_index \_type \_id etc... ).
> > > > > 
> > > > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > 
> > > > > > This is what you get by default when you search (for example, with  
> > > > > > just  
> > > > > > a  
> > > > > > query). Do you not get it back?
> > > > > > 
> > > > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > > > wrote:
> > > > > > 
> > > > > > > Pardon for bringing this up again as I remember reading a post on  
> > > > > > > the  
> > > > > > > mailing list about this. But, I can't seem to find it again.
> > > > > > > 
> > > > > > > Basically, I just would like to get the \_source of each hit (e.g.  
> > > > > > > the  
> > > > > > > original json document that was sent). I think it is doable via  
> > > > > > > scripts / filters.
> > > > > > > 
> > > > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > > > including a sample code line.
> > > > > > > 
> > > > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![Ted\_Karmel](https://avatars.discourse-cdn.com/v4/letter/t/e9a140/32.png) [@Ted\_Karmel](https://discuss.elastic.co/u/Ted_Karmel)\
**Post date:** [October 12, 2010, 12:09am UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/9 "2010-10-12T00:09:15Z")

</div>

Alright Shay. Thanks for the reply and discussion. I trust your  
opinion. I am just a grasshopper 🙂

On Mon, Oct 11, 2010 at 11:49 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:

> Yea, I know what you mean. I personally very much like what I call the "Mr.  
> Miyagi" architecture (JSON IN, JSON OUT).  
> Elasticsearch does not have the ability you want. The ability to search  
> across types / indices is used by several users, and then it does make sense  
> to return that information (not to mention facets and others). Adding this  
> as an option opens a dangerous path, where people will want different  
> formats and different aspects of what to return, which means that  
> implementing something like "curl -XGET  
> host:9200/\_search?format=no\_index\_no\_type\_just\_array\_of\_sources" is not the  
> right solution to the problem (exaggerating here a bit, but it can lead to  
> that 🙂 ).  
> I have some ideas on how to maybe help to create such a feature. But its a  
> bit down the road, and requires some previous features / foundation to be  
> built (hint, it has to do with all those scripting lang support I have been  
> adding lately 😉 ).  
> -shay.banon
> 
> On Mon, Oct 11, 2010 at 11:21 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:
> 
> > Yes. It can absolutely be transformed in another part of the stack.  
> > But, I am minimally inclined and think that systems should be data  
> > led. The rest of the stack really is just middleware that can be  
> > whittled down.
> > 
> > I find that the vast majority of the requests I make do not really  
> > need meta information. A client rarely needs meta information  
> > displayed. The id / location of the document is not necessary unless  
> > you are editing the document. And I mostly write or read. And my  
> > requests are quite fault-tolerant. In that context, I would just like  
> > that simple json format to be the default for my responses as that is  
> > what I need the majority of the time.
> > 
> > I can of course edit the results down each time. I just thought,  
> > perhaps mistakenly, that Elasticsearch had this capability.
> > 
> > On Mon, Oct 11, 2010 at 9:23 PM, Shay Banon  
> > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > 
> > > I see now. So you just want an array of source results, without any meta  
> > > information for the response? This means that there won't be places to  
> > > put  
> > > facets results for example, as well as no indication where a result came  
> > > from and if it (partially) failed or not. Can I ask why you want this?  
> > > Can't  
> > > it be done it be transformed to the format you want up the stack from  
> > > elasticsearch?
> > > 
> > > On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > wrote:
> > > 
> > > > Sure.
> > > > 
> > > > Ok, I will provide the response I get for a search in sample 1. I  
> > > > will provide what I would like to get in sample 2.
> > > > 
> > > > I search via URL parameters :
> > > > 
> > > > [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> > > > 
> > > > Thanks in advance for taking a look.
> > > > 
> > > > Sample 1 :
> > > > 
> > > > {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
> > > > "\_source" : {  
> > > > "user" : "yoyo",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "Elastic is fun"
> > > > 
> > > > }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
> > > > "\_source" : {  
> > > > "user" : "bulgogi",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "Elastic Search is cool"
> > > > 
> > > > }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
> > > > "\_source" : {  
> > > > "user" : "kimchy",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "trying out Elastic Search"  
> > > > }}]}}
> > > > 
> > > > Sample 2 :
> > > > 
> > > > [{  
> > > > "user" : "yoyo",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "Elastic is fun"  
> > > > }, {  
> > > > "user" : "bulgogi",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "Elastic Search is cool"  
> > > > }, {  
> > > > "user" : "kimchy",  
> > > > "postDate" : "2009-11-15T14:12:12",  
> > > > "message" : "trying out Elastic Search"  
> > > > }]
> > > > 
> > > > On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > 
> > > > > Not sure I understand.., what do you mean directly? Do you want to  
> > > > > get  
> > > > > it as  
> > > > > part of a search response for each hit? Do you maybe want to get just  
> > > > > part  
> > > > > of the \_source? Maybe an example would help...
> > > > > 
> > > > > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > > wrote:
> > > > > 
> > > > > > Sorry for not being specific. What I meant is only getting the  
> > > > > > \_source of each hit directly (without the contextual information  
> > > > > > like  
> > > > > > \_index \_type \_id etc... ).
> > > > > > 
> > > > > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > > > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > > > > 
> > > > > > > This is what you get by default when you search (for example, with  
> > > > > > > just  
> > > > > > > a  
> > > > > > > query). Do you not get it back?
> > > > > > > 
> > > > > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Pardon for bringing this up again as I remember reading a post on  
> > > > > > > > the  
> > > > > > > > mailing list about this. But, I can't seem to find it again.
> > > > > > > > 
> > > > > > > > Basically, I just would like to get the \_source of each hit (e.g.  
> > > > > > > > the  
> > > > > > > > original json document that was sent). I think it is doable via  
> > > > > > > > scripts / filters.
> > > > > > > > 
> > > > > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > > > > including a sample code line.
> > > > > > > > 
> > > > > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![searchersteve](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchersteve/32/3008_2.png) [@searchersteve](https://discuss.elastic.co/u/searchersteve)\
**Post date:** [January 3, 2011, 6:58pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/10 "2011-01-03T18:58:26Z")

</div>

Piping in a little late here, but just a thought, for Shay:

Ted Karmel's example of an Elasticsearch response (quoted below) was the only place I could find the schema documented. I may be overlooking it, but I looked all over in the documentation and could find a sample that showed the way that "Hits" are presented by the API. You might add something about it in the docs. Just a suggestion... Keep up the great work! I'm just beginning to explore ES, but I find it pretty mind-blowing.

I see now. So you just want an array of source results, without any meta information for the response? This means that there won't be places to put facets results for example, as well as no indication where a result came from and if it (partially) failed or not. Can I ask why you want this? Can't it be done it be transformed to the format you want up the stack from elasticsearch?

On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Sure.
> 
> Ok, I will provide the response I get for a search in sample 1. I  
> will provide what I would like to get in sample 2.
> 
> I search via URL parameters :
> 
> [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> 
> Thanks in advance for taking a look.
> 
> Sample 1 :
> 
> {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
> "\_source" : {  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
> "\_source" : {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
> "\_source" : {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }}]}}
> 
> Sample 2 :
> 
> [{  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"  
> }, {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"  
> }, {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }]
> 
> On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Not sure I understand.., what do you mean directly? Do you want to get it  
> > as  
> > part of a search response for each hit? Do you maybe want to get just  
> > part  
> > of the \_source? Maybe an example would help...
> > 
> > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > wrote:
> > 
> > > Sorry for not being specific. What I meant is only getting the  
> > > \_source of each hit directly (without the contextual information like  
> > > \_index \_type \_id etc... ).
> > > 
> > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > This is what you get by default when you search (for example, with  
> > > > just  
> > > > a  
> > > > query). Do you not get it back?
> > > > 
> > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Pardon for bringing this up again as I remember reading a post on the  
> > > > > mailing list about this. But, I can't seem to find it again.
> > > > > 
> > > > > Basically, I just would like to get the \_source of each hit (e.g. the  
> > > > > original json document that was sent). I think it is doable via  
> > > > > scripts / filters.
> > > > > 
> > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > including a sample code line.
> > > > > 
> > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![searchersteve](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/searchersteve/32/3008_2.png) [@searchersteve](https://discuss.elastic.co/u/searchersteve)\
**Post date:** [January 4, 2011, 12:43am UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/11 "2011-01-04T00:43:58Z")

</div>

Sorry, finally found it:

[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/search/body\_request/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/body_request/)

Piping in a little late here, but just a thought, for Shay:

Ted Karmel's example of an Elasticsearch response (quoted below) was the only place I could find the schema documented. I may be overlooking it, but I looked all over in the documentation and could find a sample that showed the way that "Hits" are presented by the API. You might add something about it in the docs. Just a suggestion... Keep up the great work! I'm just beginning to explore ES, but I find it pretty mind-blowing.

I see now. So you just want an array of source results, without any meta information for the response? This means that there won't be places to put facets results for example, as well as no indication where a result came from and if it (partially) failed or not. Can I ask why you want this? Can't it be done it be transformed to the format you want up the stack from elasticsearch?

On Mon, Oct 11, 2010 at 10:19 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com) wrote:

> Sure.
> 
> Ok, I will provide the response I get for a search in sample 1. I  
> will provide what I would like to get in sample 2.
> 
> I search via URL parameters :
> 
> [http://localhost:9200/twitter/tweet/\_search?q=message:elastic](http://localhost:9200/twitter/tweet/_search?q=message:elastic)
> 
> Thanks in advance for taking a look.
> 
> Sample 1 :
> 
> {"\_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":3,"max\_score":0.19178301,"hits":[{"\_index":"twitter","\_type":"tweet","\_id":"03b39eaa-6c53-4015-8ea8-0f29a90b5925","\_score":0.19178301,  
> "\_source" : {  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"6d89b8e9-4485-4993-a898-04f6c46a45b3","\_score":0.15342641,  
> "\_source" : {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"
> 
> }},{"\_index":"twitter","\_type":"tweet","\_id":"cddec754-a7f9-43f5-9179-0b03619db9fc","\_score":0.15342641,  
> "\_source" : {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }}]}}
> 
> Sample 2 :
> 
> [{  
> "user" : "yoyo",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic is fun"  
> }, {  
> "user" : "bulgogi",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "Elastic Search is cool"  
> }, {  
> "user" : "kimchy",  
> "postDate" : "2009-11-15T14:12:12",  
> "message" : "trying out Elastic Search"  
> }]
> 
> On Mon, Oct 11, 2010 at 8:30 PM, Shay Banon  
> [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Not sure I understand.., what do you mean directly? Do you want to get it  
> > as  
> > part of a search response for each hit? Do you maybe want to get just  
> > part  
> > of the \_source? Maybe an example would help...
> > 
> > On Mon, Oct 11, 2010 at 9:27 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > wrote:
> > 
> > > Sorry for not being specific. What I meant is only getting the  
> > > \_source of each hit directly (without the contextual information like  
> > > \_index \_type \_id etc... ).
> > > 
> > > On Mon, Oct 11, 2010 at 7:23 PM, Shay Banon  
> > > [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> > > 
> > > > This is what you get by default when you search (for example, with  
> > > > just  
> > > > a  
> > > > query). Do you not get it back?
> > > > 
> > > > On Mon, Oct 11, 2010 at 8:17 PM, Ted Karmel [ted.karmel@gmail.com](mailto:ted.karmel@gmail.com)  
> > > > wrote:
> > > > 
> > > > > Pardon for bringing this up again as I remember reading a post on the  
> > > > > mailing list about this. But, I can't seem to find it again.
> > > > > 
> > > > > Basically, I just would like to get the \_source of each hit (e.g. the  
> > > > > original json document that was sent). I think it is doable via  
> > > > > scripts / filters.
> > > > > 
> > > > > I would appreciate anybody pointing me in the right direction or  
> > > > > including a sample code line.
> > > > > 
> > > > > Thanks.

---

<div class="post-metadata">

**Author:** ![redolcas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/redolcas/32/6466_2.png) [@redolcas](https://discuss.elastic.co/u/redolcas)\
**Post date:** [December 7, 2015, 2:57pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/12 "2015-12-07T14:57:55Z")

</div>

Is it possible to get such result list\* (without any metadata) with ElasticSearch 2.1.0?

\*As in the previous messages in this thread:

```
[{ 
"user" : "yoyo", 
"postDate" : "2009-11-15T14:12:12", 
"message" : "Elastic is fun" 
}, { 
"user" : "bulgogi", 
"postDate" : "2009-11-15T14:12:12", 
"message" : "Elastic Search is cool" 
}, { 
"user" : "kimchy", 
"postDate" : "2009-11-15T14:12:12", 
"message" : "trying out Elastic Search" 
}]
```

---

<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:33pm UTC](https://discuss.elastic.co/t/getting--source-of-each-hit/3432/13 "2017-07-05T23:33:00Z")

</div>


