How to retrieve specific _source inner fields


(Giles Velarde) #1

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: "PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}
],
...
}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.


(Shay Banon) #2

This was fixed in master. Can you give it a whirl?
On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: "PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}
],
...
}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.


(Giles Velarde) #3

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.com wrote:

This was fixed in master. Can you give it a whirl?

On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.


(Giles Velarde) #4

I have just tried it on the master, same result unfortunately. I attach the
log output and screenshots of the different requests.

Best, Giles.

On 7 February 2011 19:48, Giles Velarde giles.velarde@gmail.com wrote:

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.com wrote:

This was fixed in master. Can you give it a whirl?

On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.


(Shay Banon) #5

Can you just gist a curl recreation?
On Tuesday, February 8, 2011 at 1:36 PM, Giles Velarde wrote:

I have just tried it on the master, same result unfortunately. I attach the log output and screenshots of the different requests.

Best, Giles.

On 7 February 2011 19:48, Giles Velarde giles.velarde@gmail.com wrote:

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.com wrote:

This was fixed in master. Can you give it a whirl?
On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.

Attachments:

  • logfile.txt

  • 1 complete entry.png

  • 3 mapping.png

  • 2 requesting coordinates field.png


(Giles Velarde) #6

Done : https://gist.github.com/816572

Best, Giles.

On 8 February 2011 14:18, Shay Banon shay.banon@elasticsearch.com wrote:

Can you just gist a curl recreation?

On Tuesday, February 8, 2011 at 1:36 PM, Giles Velarde wrote:

I have just tried it on the master, same result unfortunately. I attach the
log output and screenshots of the different requests.

Best, Giles.

On 7 February 2011 19:48, Giles Velarde giles.velarde@gmail.com wrote:

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.com wrote:

This was fixed in master. Can you give it a whirl?

On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.

Attachments:

  • logfile.txt
  • 1 complete entry.png
  • 3 mapping.png
  • 2 requesting coordinates field.png

(Shay Banon) #7

Now I understand what happens. You use GET (which I missed) and not search. This feature is not enabled for get (getting by source fields), you can open an issue for this.
On Tuesday, February 8, 2011 at 5:24 PM, Giles Velarde wrote:

Done : https://gist.github.com/816572

Best, Giles.

On 8 February 2011 14:18, Shay Banon shay.banon@elasticsearch.com wrote:

Can you just gist a curl recreation?
On Tuesday, February 8, 2011 at 1:36 PM, Giles Velarde wrote:

I have just tried it on the master, same result unfortunately. I attach the log output and screenshots of the different requests.

Best, Giles.

On 7 February 2011 19:48, Giles Velarde giles.velarde@gmail.com wrote:

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.com wrote:

This was fixed in master. Can you give it a whirl?
On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.

Attachments:

  • logfile.txt

  • 1 complete entry.png

  • 3 mapping.png

  • 2 requesting coordinates field.png


(Giles Velarde) #8

Done: https://github.com/elasticsearch/elasticsearch/issues/issue/677

Best, Giles.

On 8 February 2011 15:30, Shay Banon shay.banon@elasticsearch.com wrote:

Now I understand what happens. You use GET (which I missed) and not
search. This feature is not enabled for get (getting by source fields), you
can open an issue for this.

On Tuesday, February 8, 2011 at 5:24 PM, Giles Velarde wrote:

Done : https://gist.github.com/816572

Best, Giles.

On 8 February 2011 14:18, Shay Banon shay.banon@elasticsearch.com wrote:

Can you just gist a curl recreation?

On Tuesday, February 8, 2011 at 1:36 PM, Giles Velarde wrote:

I have just tried it on the master, same result unfortunately. I attach
the log output and screenshots of the different requests.

Best, Giles.

On 7 February 2011 19:48, Giles Velarde giles.velarde@gmail.com wrote:

Happy to! Thanks!

On 7 February 2011 18:25, Shay Banon shay.banon@elasticsearch.comwrote:

This was fixed in master. Can you give it a whirl?

On Monday, February 7, 2011 at 2:23 PM, Giles Velarde wrote:

Hi,

I am trying to understand how to select the name of the fields to
return. I have read around but could not find an example for this,
though I have seen that it is a recent feature (https://github.com/
elasticsearch/elasticsearch/issues/issue/562).

For example I have a document :

http://localhost:9200/features/Feature/PFA0005w:pep
{
_index: "features",
_type: "Feature",
_id: "PFA0005w:pep",
_source: {
uniqueName: ""PFA0005w:pep"
...
coordinates: [
{
region: "Pf3D7_01",
fmin: 29733,
fmax: 37349,
phase: null,
strand: 0,
}}
],
...
}}
}

For which I would like to pull only its coordinates array. If I try :

http://localhost:9200/features/Feature/PFA0005w:pep?fields=_source.coordinates
{
error: "ElasticSearchException[No mapping for field
[_source.coordinates] in type [Feature]]"
}

Any help constructing the right request would be most appreciated.

Best, Giles.

Attachments:

  • logfile.txt
  • 1 complete entry.png
  • 3 mapping.png
  • 2 requesting coordinates field.png

(system) #9