# 'filter' Clause

The `filter` clause within a `bool` query specifies conditions that are mandatory for a document to be considered a match, in a similar manner to `'must'` clause. Unlike the `must` clause, the `filter` clause does not affect the document score.

**Example -**

```json
{
  "query": {
    "bool": {
      "must": 
        { "term": { "Bird": "Asian Koel" } }
      ,
      "filter": [
        { "term": { "Country": "India" } },
        { "term": { "Color": "Black" } }
      ]
    }
  }
}
```

In the above example, all candidates must satisfy the condition -

* exact match over the 'bird' field, with score equals TF-IDF score for { "Bird": "Asian Koel" }

In addition, any matched documents must satisfy the following conditions -

* exact match over the 'Country' field, with score equals TF-IDF score for { "Bird": "Asian Koel" }
* exact match over "Color" field, with score equals TF-IDF score for { "In Stock": "true" }

The overall score will be the rarity score, determined by the `"must": { "term": { "Bird": "Asian Koel" } }` clause.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyper-space.io/hyperspace-docs/api-documentation/dsl-query-framework/bool-queries/filter-clause.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
