diff --git a/402_Nested/32_Nested_query.asciidoc b/402_Nested/32_Nested_query.asciidoc index 54c7d7702..d680ceb7a 100644 --- a/402_Nested/32_Nested_query.asciidoc +++ b/402_Nested/32_Nested_query.asciidoc @@ -12,17 +12,32 @@ GET /my_index/blogpost/_search "query": { "bool": { "must": [ - { "match": { "title": "eggs" }}, <1> + { + "match": { + "title": "eggs" <1> + } + }, { "nested": { "path": "comments", <2> "query": { "bool": { "must": [ <3> - { "match": { "comments.name": "john" }}, - { "match": { "comments.age": 28 }} + { + "match": { + "comments.name": "john" + } + }, + { + "match": { + "comments.age": 28 + } + } ] - }}}} + } + } + } + } ] }}} -------------------------- @@ -58,20 +73,37 @@ GET /my_index/blogpost/_search "query": { "bool": { "must": [ - { "match": { "title": "eggs" }}, + { + "match": { + "title": "eggs" + } + }, { "nested": { - "path": "comments", + "path": "comments", "score_mode": "max", <1> "query": { "bool": { "must": [ - { "match": { "comments.name": "john" }}, - { "match": { "comments.age": 28 }} + { + "match": { + "comments.name": "john" + } + }, + { + "match": { + "comments.age": 28 + } + } ] - }}}} + } + } + } + } ] -}}} + } + } +} -------------------------- <1> Give the root document the `_score` from the best-matching nested document.