Parent/child queries are broken?

This seems broken in 0.19.*. I had a working parent/child solution even
before the new has_child/has_parent filters were implemented (see:
http://stackoverflow.com/questions/7431889/how-can-i-retrieve-matching-children-only)
and now it doesn't work anymore.

I thought that maybe my indexes went awry, but deleting them and creating
from scratch is not a problem for me, so I did that... And it did not help.

Suprised by the outcome I tried to run the queries with authors and books
from this blog post -
http://www.spacevatican.org/2012/6/3/fun-with-elasticsearch-s-children-and-nested-documents/- just to try something very simple. So I have a dynamic (auto) mapping for
the author, a manual mapping for the book (which specifies that author is
the parent) and then added those two authors and three books. Then tried
running the query to retrieve all books by an author, I tried both
has_child and has_parent and they return 0 results. There is no error of
any kind, just 0 results. Always. And in my old solution it started
complaining about not being able to parse parent or _parent.

Could somebody take a look and run the same queries against your
ElasticSearch and tell me if parent/child queries work for you? I'll copy
the steps below:

curl -XPUT localhost:9200/authors/bare_author/1 -d'{ "name": "Multi G. Enre"
}' curl -XPUT localhost:9200/authors/bare_author/2 -d'{ "name": "Alastair
Reynolds" }'

curl -XPOST localhost:9200/authors/book/_mapping -d '{ "book":{ "_parent": {
"type": "bare_author"} } }'

curl -XPOST localhost:9200/authors/book/1?parent=2 -d '{ "name": "Revelation
Space", "genre": "scifi", "publisher": "penguin" }' curl -XPOST localhost:
9200/authors/book/2?parent=1 -d '{ "name": "Guns and lasers", "genre":
"scifi", "publisher": "orbit" }' curl -XPOST localhost:9200/authors/book/3
?parent=1 -d '{ "name": "Dead in the night", "genre": "thriller",
"publisher": "penguin" }'

curl -XPOST localhost:9200/authors/bare_author/_search -d '{ "query": {
"has_child": { "type": "book", "query" : { "filtered": { "query": {
"match_all": {}}, "filter" : { "and": [ {"term": {"publisher": "penguin"}},
{"term": {"genre": "scifi"}} ] } } } } } }'

The last query should return all science fiction books published by
Penguin. It doesn't return anything. The query below should find all books
written by Multi G. Enre, again - it returns nothing (0 results):

curl -XGET localhost:9200/authors/book/_search -d '{
"query": "has_parent": "parent_type": "bare_author", "query": "term":
"name": "Multi G. Enre" } } } } }'

What's going on? :frowning:

--

The last query should of course return all books written by Multi G. Enre,
Google cut my text (probably formatting issue).

--

Hi,

Do you think you can prepare gist with curl commands (aka recreation) and
specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" pawel.krakowiak@gmail.com
napsal(a):

The last query should of course return all books written by *Multi G. Enre
*, Google cut my text (probably formatting issue).

--

--

Additionally include your mapping if you can.

On Tuesday, November 20, 2012 6:23:03 AM UTC+13, Lukáš Vlček wrote:

Hi,

Do you think you can prepare gist with curl commands (aka recreation) and
specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" <pawel.k...@gmail.com <javascript:>>
napsal(a):

The last query should of course return all books written by Multi G.
Enre
, Google cut my text (probably formatting issue).

--

--

I don't know how a gist would help since it's the same text I pasted above
:), but here you go https://gist.github.com/4116598. My original post
contains all commands that are required to repeat the test. I am running
the newest Elasticsearch 0.19.11 but it did not work in 0.19.10 either, not
sure about earlier.

The mapping is also included in my original post - there's an explicit
mapping for the books only, authors get mapped dynamically when the first
author is added.

All I'm asking is for somebody to copy the commands that I provided and run
them against their ES. If you don't get any results that would mean that ES
has a bug.

W dniu wtorek, 20 listopada 2012 04:28:33 UTC+1 użytkownik Chris Male
napisał:

Additionally include your mapping if you can.

On Tuesday, November 20, 2012 6:23:03 AM UTC+13, Lukáš Vlček wrote:

Hi,

Do you think you can prepare gist with curl commands (aka recreation) and
specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" pawel.k...@gmail.com napsal(a):

The last query should of course return all books written by Multi G.
Enre
, Google cut my text (probably formatting issue).

--

--

My 0.19.11 ES is running on OS X (installed from Homebrew). I just ran the
same test on an older 0.19.2 release on Windows and it works...

W dniu wtorek, 20 listopada 2012 09:03:09 UTC+1 użytkownik Paweł Krakowiak
napisał:

I don't know how a gist would help since it's the same text I pasted above
:), but here you go https://gist.github.com/4116598. My original post
contains all commands that are required to repeat the test. I am running
the newest Elasticsearch 0.19.11 but it did not work in 0.19.10 either, not
sure about earlier.

The mapping is also included in my original post - there's an explicit
mapping for the books only, authors get mapped dynamically when the first
author is added.

All I'm asking is for somebody to copy the commands that I provided and
run them against their ES. If you don't get any results that would mean
that ES has a bug.

W dniu wtorek, 20 listopada 2012 04:28:33 UTC+1 użytkownik Chris Male
napisał:

Additionally include your mapping if you can.

On Tuesday, November 20, 2012 6:23:03 AM UTC+13, Lukáš Vlček wrote:

Hi,

Do you think you can prepare gist with curl commands (aka recreation)
and specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" pawel.k...@gmail.com napsal(a):

The last query should of course return all books written by Multi G.
Enre
, Google cut my text (probably formatting issue).

--

--

I tried with 0.19.3 on OS X, it doesn't work either. Running the attached
bash script. It runs OK, just doesn't return any results. :frowning:

W dniu wtorek, 20 listopada 2012 09:04:16 UTC+1 użytkownik Paweł Krakowiak
napisał:

My 0.19.11 ES is running on OS X (installed from Homebrew). I just ran the
same test on an older 0.19.2 release on Windows and it works...

W dniu wtorek, 20 listopada 2012 09:03:09 UTC+1 użytkownik Paweł Krakowiak
napisał:

I don't know how a gist would help since it's the same text I pasted
above :), but here you go https://gist.github.com/4116598. My original
post contains all commands that are required to repeat the test. I am
running the newest Elasticsearch 0.19.11 but it did not work in 0.19.10
either, not sure about earlier.

The mapping is also included in my original post - there's an explicit
mapping for the books only, authors get mapped dynamically when the first
author is added.

All I'm asking is for somebody to copy the commands that I provided and
run them against their ES. If you don't get any results that would mean
that ES has a bug.

W dniu wtorek, 20 listopada 2012 04:28:33 UTC+1 użytkownik Chris Male
napisał:

Additionally include your mapping if you can.

On Tuesday, November 20, 2012 6:23:03 AM UTC+13, Lukáš Vlček wrote:

Hi,

Do you think you can prepare gist with curl commands (aka recreation)
and specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" pawel.k...@gmail.com
napsal(a):

The last query should of course return all books written by Multi G.
Enre
, Google cut my text (probably formatting issue).

--

--

Your gist is missing _refresh (curl -XPOST
localhost:9200/authors/_refresh) before _search, which means that records
might not be indexed yet when you run search for the first time. After
adding _refresh everything seem to work. I get one record back as
expected. I tried it with 0.19.3 and 0.19.11 on OS X.

On Tuesday, November 20, 2012 4:03:04 AM UTC-5, Paweł Krakowiak wrote:

I tried with 0.19.3 on OS X, it doesn't work either. Running the attached
bash script. It runs OK, just doesn't return any results. :frowning:

W dniu wtorek, 20 listopada 2012 09:04:16 UTC+1 użytkownik Paweł Krakowiak
napisał:

My 0.19.11 ES is running on OS X (installed from Homebrew). I just ran
the same test on an older 0.19.2 release on Windows and it works...

W dniu wtorek, 20 listopada 2012 09:03:09 UTC+1 użytkownik Paweł
Krakowiak napisał:

I don't know how a gist would help since it's the same text I pasted
above :), but here you go https://gist.github.com/4116598. My
original post contains all commands that are required to repeat the test. I
am running the newest Elasticsearch 0.19.11 but it did not work in 0.19.10
either, not sure about earlier.

The mapping is also included in my original post - there's an explicit
mapping for the books only, authors get mapped dynamically when the first
author is added.

All I'm asking is for somebody to copy the commands that I provided and
run them against their ES. If you don't get any results that would mean
that ES has a bug.

W dniu wtorek, 20 listopada 2012 04:28:33 UTC+1 użytkownik Chris Male
napisał:

Additionally include your mapping if you can.

On Tuesday, November 20, 2012 6:23:03 AM UTC+13, Lukáš Vlček wrote:

Hi,

Do you think you can prepare gist with curl commands (aka recreation)
and specify version of ES used in test? That can help.

Regards,
Lukáš
Dne 19.11.2012 17:35 "Paweł Krakowiak" pawel.k...@gmail.com
napsal(a):

The last query should of course return all books written by Multi
G. Enre
, Google cut my text (probably formatting issue).

--

--