> For the complete documentation index, see [llms.txt](https://learnsql.gitbook.io/lernmysql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnsql.gitbook.io/lernmysql/bool-query.md).

# Bool Query

Một truy vấn đối sánh các tài liệu khớp với các kết hợp boolean của các truy vấn khác. Truy vấn bool ánh xạ tới Lucene BooleanQuery. Nó được xây dựng bằng cách sử dụng một hoặc nhiều mệnh đề boolean, mỗi mệnh đề có một lần xuất hiện được nhập. Các kiểu xuất hiện là:

```
{
    "bool" : {
        "must" : {
            "term" : { "user" : "kimchy" }
        },
        "must_not" : {
            "range" : {
                "age" : { "from" : 10, "to" : 20 }
            }
        },
        "should" : [
            {
                "term" : { "tag" : "wow" }
            },
            {
                "term" : { "tag" : "elasticsearch" }
            }
        ],
        "minimum_should_match" : 1,
        "boost" : 1.0
    }
}
```
