Viewing nested objects

I built a nested object within another object, but I'm still working out
how to get the queries right.
When I was 1st working with a child object, I could use the head
application and query on the child objects separately.
But I don't know the name of the nested object
(Note I set include_in_parent of my nested object to false)

Is there a way to use the REST API to query just the nested objects?
http://localhost:9200/myindex//_search ....

Do the nested objects have a predictable name based on the names given
in the mapping?
anObject : {
dynamic: "strict"
,properties : {
"name": { type:"string", store:1,
index:"analyzed", omit_norms:0, omit_term_freq_positions:0,
term_vector:"yes" }
, "Codes": {
type:"nested"
,dynamic: "strict"
,"include_in_parent" : "false"
,properties: {
"thing1" : { type:"string", store:1,
index:"analyzed", omit_norms:0, omit_term_freq_positions:0,
term_vector:"yes" }
"thing2" : { type:"string", store:1,
index:"analyzed", omit_norms:0, omit_term_freq_positions:0,
term_vector:"yes" }
}
}

-Paul

--

They have a predictable name, but, queries on nested objects must be wrapped in a nested query (or filter). If you still want to use the URI option to query it, you can build the search request full "body", and provide it in a "source" parameter.

On Oct 19, 2012, at 2:22 AM, P. Hill parehill1@gmail.com wrote:

I built a nested object within another object, but I'm still working out how to get the queries right.
When I was 1st working with a child object, I could use the head application and query on the child objects separately.
But I don't know the name of the nested object
(Note I set include_in_parent of my nested object to false)

Is there a way to use the REST API to query just the nested objects?
http://localhost:9200/myindex//_search ....

Do the nested objects have a predictable name based on the names given in the mapping?
anObject : {
dynamic: "strict"
,properties : {
"name": { type:"string", store:1, index:"analyzed", omit_norms:0, omit_term_freq_positions:0, term_vector:"yes" }
, "Codes": {
type:"nested"
,dynamic: "strict"
,"include_in_parent" : "false"
,properties: {
"thing1" : { type:"string", store:1, index:"analyzed", omit_norms:0, omit_term_freq_positions:0, term_vector:"yes" }
"thing2" : { type:"string", store:1, index:"analyzed", omit_norms:0, omit_term_freq_positions:0, term_vector:"yes" }
}
}

-Paul

--

--

I don't understand.

If nested queries must be wrapped, what does it matter that I want to
use it? To me, your statement of "must" makes it sound impossible to
only query the nested objects.
The search I wanted to build was for debugging just to check I'm doing
the search right I can't image any other uses for it.

You said provide "it"? I'm guessing you mean the name, but you didn't
tell me the predictable name of a nested object. You say I should put
this name in the "source" parameter, but the search UI doesn't seem to
have a "source" parameter in the URI, so again I'm confused. Did you
mean in the source when indexing? I gave the nested object a name when
indexing, but I don't know how that maps to what to say when searching.

What is the predictable name?
Example I have "MyOuter" with a nested object "MyNested".
Define "must be nested"?
Where is this source parameter?

-Paul

On 10/20/2012 6:01 PM, kimchy@gmail.com wrote:

They have a predictable name, but, queries on nested objects must be wrapped in a nested query (or filter). If you still want to use the URI option to query it, you can build the search request full "body", and provide it in a "source" parameter.

On Oct 19, 2012, at 2:22 AM, P. Hillparehill1@gmail.com wrote:

I built a nested object within another object, but I'm still working out how to get the queries right.
When I was 1st working with a child object, I could use the head application and query on the child objects separately.
But I don't know the name of the nested object
(Note I set include_in_parent of my nested object to false)

Is there a way to use the REST API to query just the nested objects?
http://localhost:9200/myindex//_search ....

Do the nested objects have a predictable name based on the names given in the mapping?

--

Hi Paul,

On Tue, Oct 30, 2012 at 5:56 AM, P.Hill parehill1@gmail.com wrote:

I don't understand.

If nested queries must be wrapped, what does it matter that I want to use
it? To me, your statement of "must" makes it sound impossible to only query
the nested objects.
The search I wanted to build was for debugging just to check I'm doing the
search right I can't image any other uses for it.

You said provide "it"? I'm guessing you mean the name, but you didn't
tell me the predictable name of a nested object. You say I should put
this name in the "source" parameter, but the search UI doesn't seem to have
a "source" parameter in the URI, so again I'm confused. Did you mean in
the source when indexing? I gave the nested object a name when indexing,
but I don't know how that maps to what to say when searching.

What is the predictable name?
Example I have "MyOuter" with a nested object "MyNested".

In this case I think internal type name for the nested objects will be
"__MyNested". But, keep in mind that querying against nested type will not
yield any data. AFAIK ES does not allow you to do that (and there are good
reasons not to let users do it, among others that would mean that nested
objects would have to be exposed along with some kind of document ID and
that could create false impression that you can freely manipulate/update
individual nested documents, which is not currently possible via ES API.).

Define "must be nested"?

The query that involves nested object query (or filter) yields parent
documents only. That's all about it.
So the query or filter is supposed to include "nested : {...}" clause. That
is the only way how you can create query/filter that is run against nested
documents and yields list of parent documents.

Where is this source parameter?

I think what Shay was referring to was "source" URL parameter as described
here: Elasticsearch Platform — Find real-time answers at scale | Elastic (see "Request body
in query string").

HTH,
Lukas

-Paul

On 10/20/2012 6:01 PM, kimchy@gmail.com wrote:

They have a predictable name, but, queries on nested objects must be
wrapped in a nested query (or filter). If you still want to use the URI
option to query it, you can build the search request full "body", and
provide it in a "source" parameter.

On Oct 19, 2012, at 2:22 AM, P. Hillparehill1@gmail.com wrote:

I built a nested object within another object, but I'm still working out

how to get the queries right.
When I was 1st working with a child object, I could use the head
application and query on the child objects separately.
But I don't know the name of the nested object
(Note I set include_in_parent of my nested object to false)

Is there a way to use the REST API to query just the nested objects?
http://localhost:9200/myindex/**/_search ....

Do the nested objects have a predictable name based on the names given
in the mapping?

--

--