QueryParsingException[[test] [has_child] Type [revision] does not have parent mapping];


(cwho) #1

I am using ES 0.14.3.
I'm trying to set up a parent child relationshpi between types
"entity" and "revision". But search does not appear to be working -
throws a QueryParsingException[[test] [has_child] Type [revision]
does not have parent mapping];

Below is what I used to reproduce this. Do I have to set up parent/
child mappings somewhere?

e.g.:

curl -XPOST 'http://localhost:9200/test/entity/1?pretty=true' -d '{

"myid" : "1",
"mydoctype" : "entity"
}
'
{
"ok" : true,
"_index" : "test",
"_type" : "entity",
"_id" : "1"
}

curl -XPOST 'http://localhost:9200/test/revision/2?

parent=1&pretty=true' -d '{

"myid" : "2",
"mydoctype" : "revision",
"myrevhead" : "1"
}
'
{
"ok" : true,
"_index" : "test",
"_type" : "revision",
"_id" : "2"
}

curl -XGET 'http://localhost:9200/test/_search?pretty=true' -d '{

"from" : 0,
"size" : 10,
"query" : {
"has_child" : {
"type" : "revision",
"query" : {
"term" : { "mydoctype" : "revision" }
}
}
}
}
'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase
[query], total failure; shardFailures {[iAgSuwSZRoiszXvHTbpzRg][test]
[0]: SearchParseException[[test][0]: from[0],size[10]: Parse Failure
[Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :
{\n"has_child" : {\n"type" : "revision",\n"query" : {\n"term
" : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:
QueryParsingException[[test] [has_child] Type [revision] does not
have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][1]:
SearchParseException[[test][1]: from[0],size[10]: Parse Failure
[Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :
{\n"has_child" : {\n"type" : "revision",\n"query" : {\n"term
" : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:
QueryParsingException[[test] [has_child] Type [revision] does not
have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][2]:
SearchParseException[[test][2]: from[0],size[10]: Parse Failure
[Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :
{\n"has_child" : {\n"type" : "revision",\n"query" : {\n"term
" : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:
QueryParsingException[[test] [has_child] Type [revision] does not
have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][3]:
SearchParseException[[test][3]: from[0],size[10]: Parse Failure
[Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :
{\n"has_child" : {\n"type" : "revision",\n"query" : {\n"term
" : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:
QueryParsingException[[test] [has_child] Type [revision] does not
have parent mapping]; }{[iAgSuwSZRoiszXvHTbpzRg][test][4]:
SearchParseException[[test][4]: from[0],size[10]: Parse Failure
[Failed to parse source [{\n"from" : 0,\n"size" : 10,\n"query" :
{\n"has_child" : {\n"type" : "revision",\n"query" : {\n"term
" : { "mydoctype" : "revision" }\n}\n}\n}\n}\n]]]; nested:
QueryParsingException[[test] [has_child] Type [revision] does not
have parent mapping]; }]"
}


(Clinton Gormley) #2

On Wed, 2011-02-16 at 21:39 -0800, cwho80 wrote:

I am using ES 0.14.3.
I'm trying to set up a parent child relationshpi between types
"entity" and "revision". But search does not appear to be working -
throws a QueryParsingException[[test] [has_child] Type [revision]
does not have parent mapping];

Below is what I used to reproduce this. Do I have to set up parent/
child mappings somewhere?

Yes you do, by creating a mapping. See
http://www.elasticsearch.org/guide/reference/mapping/

and specifically:
http://www.elasticsearch.org/guide/reference/mapping/parent-field.html

clint


(system) #3