Getting _source of each hit

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.

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 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.

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 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 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.

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 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 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
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.

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

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 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 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 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
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.

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 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

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 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
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 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
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.

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 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 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

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 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
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 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
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.

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 :slight_smile: ).

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 :wink: ).

-shay.banon

On Mon, Oct 11, 2010 at 11:21 PM, Ted Karmel 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 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
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

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 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
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 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
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.

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

On Mon, Oct 11, 2010 at 11:49 PM, Shay Banon
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 :slight_smile: ).
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 :wink: ).
-shay.banon

On Mon, Oct 11, 2010 at 11:21 PM, Ted Karmel 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 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
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

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 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
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 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
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.

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 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

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 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
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 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
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.

Sorry, finally found it:

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 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

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 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
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 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
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.

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" 
}]