Skip to content

Instantly share code, notes, and snippets.

@eranid
Created March 20, 2013 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eranid/5206390 to your computer and use it in GitHub Desktop.
Save eranid/5206390 to your computer and use it in GitHub Desktop.
has_child query fails with "does not have parent mapping"
curl -XGET 'http://localhost:9200/index1/child_type/_mapping?pretty=true'
{
"child_type" : {
"_parent" : {
"type" : "parent_type"
},
"_routing" : {
"required" : true
},
"_timestamp" : {
"enabled" : true
},
"properties" : {
"field1" : {
"type" : "string"
},
}
}
}
curl -XPOST 'http://localhost:9200/index1/parent_type/_search?pretty=true' -d '{
"query": {
"has_child": {
"type": "child_type",
"query": {
"match_all": {}
}
}
}
}'
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {[koaRL5w_QXuzLPV4QMgL6w][index1][0]: SearchParseException[[index1][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\n \"query\": {\n \"has_child\": {\n \"type\": \"child_type\",\n \"query\": {\n \"match_all\": {}\n }\n }\n }\n}]]]; nested: QueryParsingException[[index1] [has_child] Type [child_type] does not have parent mapping]; }]",
"status" : 500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment