Nested documents

Hi,

i have index "test" and type "test" with mappings:
http://pastebin.com/7uVNzBR7

and given test data:
http://pastebin.com/xNsChspp

When i try to search with nested filter on "nested_docs.nested_doc1"
http://pastebin.com/FJuLytjH, the result is collection of documents,
but when "path" is changed to "nested_docs.nested_doc2" empty result
is returned. It is similar with using nested_docs.nested_doc3 and
nested_docs.nested_doc4, only path with "nested_docs.nested_doc4"
returns collection of documents. So it seems to me when 2 nested
documents have same property name it is possible to query only one of
them with successful results. Is it a bug?

Thanks

Could anyone please help me with this nested documents problem? I
found only it works when each nested document has unique named
properties, but i guess there is other way to sort it out?

On Mar 21, 10:17 am, Petr Jancarik jancarikp...@gmail.com wrote:

Hi,

i have index "test" and type "test" with mappings:{ "test": { "properties": { "nested_docs": { - Pastebin.com

and given test data:{ "name": "asasasa", "id": "789", "nested_docs": { "nest - Pastebin.com

When i try to search with nested filter on "nested_docs.nested_doc1"{ "filter": { "nested": { "path": "nested_docs.nested - Pastebin.com, the result is collection of documents,
but when "path" is changed to "nested_docs.nested_doc2" empty result
is returned. It is similar with using nested_docs.nested_doc3 and
nested_docs.nested_doc4, only path with "nested_docs.nested_doc4"
returns collection of documents. So it seems to me when 2 nested
documents have same property name it is possible to query only one of
them with successful results. Is it a bug?

Thanks

You have here two level of nested mapping, nested_docs, and then another
one. So, you need to have two level of nested queries/filters to execute on
the second level one. Though, I am not sure you really need the nested_docs
level to be nested type.

On Wed, Mar 21, 2012 at 11:17 AM, Petr Jancarik jancarikpetr@gmail.comwrote:

Hi,

i have index "test" and type "test" with mappings:
{ "test": { "properties": { "nested_docs": { - Pastebin.com

and given test data:
{ "name": "asasasa", "id": "789", "nested_docs": { "nest - Pastebin.com

When i try to search with nested filter on "nested_docs.nested_doc1"
{ "filter": { "nested": { "path": "nested_docs.nested - Pastebin.com, the result is collection of documents,
but when "path" is changed to "nested_docs.nested_doc2" empty result
is returned. It is similar with using nested_docs.nested_doc3 and
nested_docs.nested_doc4, only path with "nested_docs.nested_doc4"
returns collection of documents. So it seems to me when 2 nested
documents have same property name it is possible to query only one of
them with successful results. Is it a bug?

Thanks

Thanks for tip, but it didn´t sort the problem out. I tried 2 level nested
queries then i remapping index and kept nested_docs without nested mapping

  • same result like before. Finally i created index without nested_docs at
    all, so every nested doc was directly in the root document, but results
    were same again. It is really strange, because only query on nested_doc1
    and nested_doc4 are successful. Why not nested_doc2 and nested_doc3?

On Sunday, March 25, 2012 12:32:15 PM UTC+2, kimchy wrote:

You have here two level of nested mapping, nested_docs, and then another
one. So, you need to have two level of nested queries/filters to execute on
the second level one. Though, I am not sure you really need the nested_docs
level to be nested type.

On Wed, Mar 21, 2012 at 11:17 AM, Petr Jancarik wrote:

Hi,

i have index "test" and type "test" with mappings:
{ "test": { "properties": { "nested_docs": { - Pastebin.com

and given test data:
{ "name": "asasasa", "id": "789", "nested_docs": { "nest - Pastebin.com

When i try to search with nested filter on "nested_docs.nested_doc1"
{ "filter": { "nested": { "path": "nested_docs.nested - Pastebin.com, the result is collection of documents,
but when "path" is changed to "nested_docs.nested_doc2" empty result
is returned. It is similar with using nested_docs.nested_doc3 and
nested_docs.nested_doc4, only path with "nested_docs.nested_doc4"
returns collection of documents. So it seems to me when 2 nested
documents have same property name it is possible to query only one of
them with successful results. Is it a bug?

Thanks

Can you gist a recreation with one level nested mapping? I will have a look.

On Sun, Mar 25, 2012 at 10:04 PM, Petr Jancarik jancarikpetr@gmail.comwrote:

Thanks for tip, but it didn´t sort the problem out. I tried 2 level nested
queries then i remapping index and kept nested_docs without nested mapping

  • same result like before. Finally i created index without nested_docs at
    all, so every nested doc was directly in the root document, but results
    were same again. It is really strange, because only query on nested_doc1
    and nested_doc4 are successful. Why not nested_doc2 and nested_doc3?

On Sunday, March 25, 2012 12:32:15 PM UTC+2, kimchy wrote:

You have here two level of nested mapping, nested_docs, and then another
one. So, you need to have two level of nested queries/filters to execute on
the second level one. Though, I am not sure you really need the nested_docs
level to be nested type.

On Wed, Mar 21, 2012 at 11:17 AM, Petr Jancarik wrote:

Hi,

i have index "test" and type "test" with mappings:
{ "test": { "properties": { "nested_docs": { - Pastebin.com

and given test data:
{ "name": "asasasa", "id": "789", "nested_docs": { "nest - Pastebin.com

When i try to search with nested filter on "nested_docs.nested_doc1"
{ "filter": { "nested": { "path": "nested_docs.nested - Pastebin.com, the result is collection of documents,
but when "path" is changed to "nested_docs.nested_doc2" empty result
is returned. It is similar with using nested_docs.nested_doc3 and
nested_docs.nested_doc4, only path with "nested_docs.nested_doc4"
returns collection of documents. So it seems to me when 2 nested
documents have same property name it is possible to query only one of
them with successful results. Is it a bug?

Thanks

Finally i found the way how to query nested documents. It wasn´t clear in
documentation. For addressing a field in nested query i used full path "
nested_docs.nested_doc2.user_id".

Here is mapping and search query i used https://gist.github.com/2216182

Thank you