Java API: client.prepareGet and parent documents

Hi!

this is my mapping:

{
"connection": {
properties: {
state: {type: "string", index: "not_analyzed",
include_in_all: false},
groupid: {type: "string", index: "not_analyzed",
include_in_all: false},
tags: {type: "string", index_name: "tag", index:
"not_analyzed", include_in_all: false}
},
_parent: {type: "company"}
}
}

when i try to retrieve a document using the JAVA API:

GetResponse response = client.prepareGet(indexName, 'connection',
'id').execute().actionGet();

i only get the fields of connection and not the ones of company!

any hint?

Thanks
Niccoló

You need to fetch the company as well. You can ask for the _parent field
from the child doc, and use that id to fetch the parent document.

On Mon, Aug 8, 2011 at 6:16 PM, nicco nicco82@gmail.com wrote:

Hi!

this is my mapping:

{
"connection": {
properties: {
state: {type: "string", index: "not_analyzed",
include_in_all: false},
groupid: {type: "string", index: "not_analyzed",
include_in_all: false},
tags: {type: "string", index_name: "tag", index:
"not_analyzed", include_in_all: false}
},
_parent: {type: "company"}
}
}

when i try to retrieve a document using the JAVA API:

GetResponse response = client.prepareGet(indexName, 'connection',
'id').execute().actionGet();

i only get the fields of connection and not the ones of company!

any hint?

Thanks
Niccoló

Thabks for your answer, another question is there a way to dynamically
get the parent type when i retrieve a connection?

Thanks!

On Aug 8, 5:20 pm, Shay Banon kim...@gmail.com wrote:

You need to fetch the company as well. You can ask for the _parent field
from the child doc, and use that id to fetch the parent document.

On Mon, Aug 8, 2011 at 6:16 PM, nicco nicc...@gmail.com wrote:

Hi!

this is my mapping:

{
"connection": {
properties: {
state: {type: "string", index: "not_analyzed",
include_in_all: false},
groupid: {type: "string", index: "not_analyzed",
include_in_all: false},
tags: {type: "string", index_name: "tag", index:
"not_analyzed", include_in_all: false}
},
_parent: {type: "company"}
}
}

when i try to retrieve a document using the JAVA API:

GetResponse response = client.prepareGet(indexName, 'connection',
'id').execute().actionGet();

i only get the fields of connection and not the ones of company!

any hint?

Thanks
Niccoló

I'm having issues finging the parentId

this is the map i get when executing response.getSource():

{tags=, groupid=210dc7b0-1cbd-4320-a044-5061318c12d4}

any hint?
thanks
On Aug 8, 5:20 pm, Shay Banon kim...@gmail.com wrote:

You need to fetch the company as well. You can ask for the _parent field
from the child doc, and use that id to fetch the parent document.

On Mon, Aug 8, 2011 at 6:16 PM, nicco nicc...@gmail.com wrote:

Hi!

this is my mapping:

{
"connection": {
properties: {
state: {type: "string", index: "not_analyzed",
include_in_all: false},
groupid: {type: "string", index: "not_analyzed",
include_in_all: false},
tags: {type: "string", index_name: "tag", index:
"not_analyzed", include_in_all: false}
},
_parent: {type: "company"}
}
}

when i try to retrieve a document using the JAVA API:

GetResponse response = client.prepareGet(indexName, 'connection',
'id').execute().actionGet();

i only get the fields of connection and not the ones of company!

any hint?

Thanks
Niccoló

You need to explicitly ask for the _parent field when you get the doc. The
type is not provided since its part of the mapping..., though, you can ask
for the mapping.

On Tue, Aug 9, 2011 at 11:44 AM, nicco nicco82@gmail.com wrote:

I'm having issues finging the parentId

this is the map i get when executing response.getSource():

{tags=, groupid=210dc7b0-1cbd-4320-a044-5061318c12d4}

any hint?
thanks
On Aug 8, 5:20 pm, Shay Banon kim...@gmail.com wrote:

You need to fetch the company as well. You can ask for the _parent field
from the child doc, and use that id to fetch the parent document.

On Mon, Aug 8, 2011 at 6:16 PM, nicco nicc...@gmail.com wrote:

Hi!

this is my mapping:

{
"connection": {
properties: {
state: {type: "string", index: "not_analyzed",
include_in_all: false},
groupid: {type: "string", index: "not_analyzed",
include_in_all: false},
tags: {type: "string", index_name: "tag", index:
"not_analyzed", include_in_all: false}
},
_parent: {type: "company"}
}
}

when i try to retrieve a document using the JAVA API:

GetResponse response = client.prepareGet(indexName, 'connection',
'id').execute().actionGet();

i only get the fields of connection and not the ones of company!

any hint?

Thanks
Niccoló