这与git
问题中指定的错误有关。线程中提到的解决方法是在
highlight_query
范例:
PUT test{ "mappings": { "my_parent": { "_all": { "store": true } }, "my_child": { "_parent": { "type": "my_parent" } } }}PUT test/my_parent/1 { "text": "This is a parent document"}PUT test/my_child/2?parent=1 { "text": "This is a child document"}POST test/my_parent/_search{ "query": { "bool": { "must": [ { "has_child": { "type": "my_child", "query": { "match": { "text": "child document" } } } }, { "match": { "_all": "parent" } } ] } }, "highlight": { "fields": { "_all": {} }, "highlight_query": { "match": { "_all": "parent" } } }}结果:
{ "_index": "test", "_type": "my_parent", "_id": "1", "_score": 1.016466, "_source": { "text": "This is a parent document" }, "highlight": { "_all": [ "This is a <em>parent</em> document " ] } }在Java
Client中,您应该可以通过此api实现它



