Nested hasChildQuery


(SK) #1

Hi all,

Context: Java api, ES 0.18.7

I'm trying to run the following query but with no success.

hasChildQuery("line", hasChildQuery("item", termQuery("value", 1))

Is there any logical reason againt using nested hasChildQuery queries?

Searching for both individually works fine returning each time the
correct parents. I assumed that combining the two would result in the
most upper parent returned as result.

The types are put in the index like this:

line: {"type":{"_parent":{"type":"plant"}}}

item: {"type":{"_parent":{"type":"line"}}}

Any ideas?


(Shay Banon) #2

Yes, it should work.

On Friday, February 24, 2012 at 2:36 PM, SK wrote:

Hi all,

Context: Java api, ES 0.18.7

I'm trying to run the following query but with no success.

hasChildQuery("line", hasChildQuery("item", termQuery("value", 1))

Is there any logical reason againt using nested hasChildQuery queries?

Searching for both individually works fine returning each time the
correct parents. I assumed that combining the two would result in the
most upper parent returned as result.

The types are put in the index like this:

line: {"type":{"_parent":{"type":"plant"}}}

item: {"type":{"_parent":{"type":"line"}}}

Any ideas?


(SK) #3

was solved with https://github.com/elasticsearch/elasticsearch/issues/1751

Thanks

On Feb 26, 8:30 pm, Shay Banon kim...@gmail.com wrote:

Yes, it should work.

On Friday, February 24, 2012 at 2:36 PM, SK wrote:

Hi all,

Context: Java api, ES 0.18.7

I'm trying to run the following query but with no success.

hasChildQuery("line", hasChildQuery("item", termQuery("value", 1))

Is there any logical reason againt using nested hasChildQuery queries?

Searching for both individually works fine returning each time the
correct parents. I assumed that combining the two would result in the
most upper parent returned as result.

The types are put in the index like this:

line: {"type":{"_parent":{"type":"plant"}}}

item: {"type":{"_parent":{"type":"line"}}}

Any ideas?


(Shay Banon) #4

Yea, it didn't work…, but it does now (0.19).

On Friday, February 24, 2012 at 2:36 PM, SK wrote:

Hi all,

Context: Java api, ES 0.18.7

I'm trying to run the following query but with no success.

hasChildQuery("line", hasChildQuery("item", termQuery("value", 1))

Is there any logical reason againt using nested hasChildQuery queries?

Searching for both individually works fine returning each time the
correct parents. I assumed that combining the two would result in the
most upper parent returned as result.

The types are put in the index like this:

line: {"type":{"_parent":{"type":"plant"}}}

item: {"type":{"_parent":{"type":"line"}}}

Any ideas?


(system) #5