刚开始玩Elasticsearch。 我试图通过查询子字段和父字段来搜索某些子文档。
{
"query": {
"bool": {
"must": [
{
"has_child": {
"type": "mychildtype",
"query": {
"match": {
"child_field": "value1"
}
}
}
},
{
"parent_field": "value2"
}
]
}
},
"fields": [
"_type",
"_id",
"parent_field1",
"parent_field2"
]
}
我收到错误:
{
"error" : "SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[PfjRtoQKRZeIxkokAo_vmA][*INDEX_NAME*][0]: SearchParseException[[*INDEX_NAME*][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [*ESCAPED QUERY*]; nested: QueryParsingException[[*INDEX_NAME*] [_na] query malformed, no field after start_object]; }]",
"status" : 400
}
我在这里做错了什么?
答案 0 :(得分:3)
我错过了一个“匹配”:{}围绕我的父字段标准。