Nested has_child query error


(domizio) #1

I am trying to use has_child on another has_child query and I get a failure.
As you can see in the mapping below, the 'product' type is the parent of the
'review' type, which is the parent of 'review_comment' type.

The relevant mapping of that index is:

{
"emp_ddb": {
"product": {
"properties": {
"created": {
"type": "date",
"format": "dateOptionalTime"
},
"description": {
"type": "string"
},
"manufacturer": {
"type": "string"
},
"model": {
"type": "string"
},
"owns_count": {
"type": "long"
},
"reviews_count": {
"type": "long"
},
"tags": {
"type": "string"
},
"tags_slug": {
"type": "string",
"index": "not_analyzed"
},
"title": {
"type": "string"
},
"updated": {
"type": "date",
"format": "dateOptionalTime"
},
"user_id": {
"type": "long"
},
"wants_count": {
"type": "long"
},
"watches_count": {
"type": "long"
}
}
},
"review_comment": {
"_parent": {
"type": "review"
},
"_routing": {
"required": true
},
"properties": {
"content": {
"type": "string"
},
"created": {
"type": "date",
"format": "dateOptionalTime"
},
"published": {
"type": "boolean"
},
"user_id": {
"type": "long"
}
}
},
"review": {
"_parent": {
"type": "product"
},
"_routing": {
"required": true
},
"properties": {
"created": {
"type": "date",
"format": "dateOptionalTime"
},
"description": {
"type": "string"
},
"title": {
"type": "string"
},
"updated": {
"type": "date",
"format": "dateOptionalTime"
},
"user_id": {
"type": "long"
}
}
}
}
}

Here is the query:

curl -XGET "http://localhost:9200/emp_ddb/product/_search?pretty=1" -d '
{
"query": {
"has_child": {
"type": "review",
"query": {
"has_child": {
"type": "review_comment",
"query": {
"match_all": {

        }
      }
    }
  }
}

}
}
'

and here is the result, when the query hits something, it gives an error,
while it is fine when the query doesn't hit anything:

{
"took" : 3372,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 4,
"failed" : 1,
"failures" : [ {
"index" : "emp_ddb",
"shard" : 2,
"status" : 500,
"reason" : "QueryPhaseExecutionException[[emp_ddb][2]:
query[filtered(ConstantScore(child_filter[review/product](filtered(ConstantScore(child_filter[review_comment/review](filtered(ConstantScore(NotDeleted(:)))->cache(_type:review_comment))))->cache(_type:review))))->cache(_type:product)],from[0],size[10]:
Query Failed [Failed to execute child query
[filtered(ConstantScore(NotDeleted(:)))->cache(_type:review_comment)]]];
nested: "
} ]
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}

What am I doing wrong?

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Nested-has-child-query-error-tp3906204p3906204.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #2