4

刚开始玩 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
}

我在这里做错了什么?

4

1 回答 1

3

我在父字段条件周围缺少“匹配”:{ }。

于 2013-11-18T14:29:48.800 回答