Fetching both _source and a specific field in scan search


(Jérémie BORDIER) #1

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


(Shay Banon) #2

Which version are you using? Something similar was fixed in 0.19.2:
https://github.com/elasticsearch/elasticsearch/issues/1833.

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


(Jérémie BORDIER) #3

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: https://github.com/elasticsearch/elasticsearch/issues/1833.

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 BORDIER) #4

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: https://github.com/elasticsearch/elasticsearch/issues/1833.

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


(system) #5