Fetching both _source and a specific field in scan search

Hi,

I'm trying to fetch both the _source field and another field that is
excluded from source, but I can't get elasticsearch to return me both
of these:

SearchResponse scrollResp = client.prepareSearch("test")
.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(60000))
.setSize(100).execute().actionGet(); //100 hits per shard will be
returned for each scroll

=> Will return source (hit.source() is filled)

	.addFields("file")

=> Will only return "file"

	.addFields("_source", "file")

=> Will only return "file"...

Any hint ?

Thanks !

Jérémie

Which version are you using? Something similar was fixed in 0.19.2:
requesting fields=_timestamp,_source won't return _source · Issue #1833 · elastic/elasticsearch · GitHub.

On Thu, Apr 26, 2012 at 4:13 PM, Jérémie BORDIER
jeremie.bordier@gmail.comwrote:

Hi,

I'm trying to fetch both the _source field and another field that is
excluded from source, but I can't get elasticsearch to return me both
of these:

SearchResponse scrollResp = client.prepareSearch("test")
.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(60000))
.setSize(100).execute().actionGet(); //100 hits per shard
will be
returned for each scroll

=> Will return source (hit.source() is filled)

           .addFields("file")

=> Will only return "file"

           .addFields("_source", "file")

=> Will only return "file"...

Any hint ?

Thanks !

Jérémie

I'm on 0.19.1, I'll give 0.19.2 a shot :slight_smile: Thanks

Jérémie

On Thu, Apr 26, 2012 at 11:15 PM, Shay Banon kimchy@gmail.com wrote:

Which version are you using? Something similar was fixed in
0.19.2: requesting fields=_timestamp,_source won't return _source · Issue #1833 · elastic/elasticsearch · GitHub.

On Thu, Apr 26, 2012 at 4:13 PM, Jérémie BORDIER jeremie.bordier@gmail.com
wrote:

Hi,

I'm trying to fetch both the _source field and another field that is
excluded from source, but I can't get elasticsearch to return me both
of these:

SearchResponse scrollResp = client.prepareSearch("test")
.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(60000))
.setSize(100).execute().actionGet(); //100 hits per shard
will be
returned for each scroll

=> Will return source (hit.source() is filled)

           .addFields("file")

=> Will only return "file"

           .addFields("_source", "file")

=> Will only return "file"...

Any hint ?

Thanks !

Jérémie

--
Jérémie 'ahFeel' BORDIER

Works ! Thanks :slight_smile:

Jérémie

On Fri, Apr 27, 2012 at 11:13 AM, Jérémie BORDIER
jeremie.bordier@gmail.com wrote:

I'm on 0.19.1, I'll give 0.19.2 a shot :slight_smile: Thanks

Jérémie

On Thu, Apr 26, 2012 at 11:15 PM, Shay Banon kimchy@gmail.com wrote:

Which version are you using? Something similar was fixed in
0.19.2: requesting fields=_timestamp,_source won't return _source · Issue #1833 · elastic/elasticsearch · GitHub.

On Thu, Apr 26, 2012 at 4:13 PM, Jérémie BORDIER jeremie.bordier@gmail.com
wrote:

Hi,

I'm trying to fetch both the _source field and another field that is
excluded from source, but I can't get elasticsearch to return me both
of these:

SearchResponse scrollResp = client.prepareSearch("test")
.setSearchType(SearchType.SCAN)
.setScroll(new TimeValue(60000))
.setSize(100).execute().actionGet(); //100 hits per shard
will be
returned for each scroll

=> Will return source (hit.source() is filled)

           .addFields("file")

=> Will only return "file"

           .addFields("_source", "file")

=> Will only return "file"...

Any hint ?

Thanks !

Jérémie

--
Jérémie 'ahFeel' BORDIER

--
Jérémie 'ahFeel' BORDIER