# Cache a bool query without filter

**URL:** <https://discuss.elastic.co/t/cache-a-bool-query-without-filter/23996>\
**Category:** Elasticsearch\
**Created:** [June 19, 2015, 2:15pm UTC](https://discuss.elastic.co/t/cache-a-bool-query-without-filter/23996 "2015-06-19T14:15:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harpreet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harpreet/32/3413_2.png) [@harpreet](https://discuss.elastic.co/u/harpreet)\
**Post date:** [June 19, 2015, 2:15pm UTC](https://discuss.elastic.co/t/cache-a-bool-query-without-filter/23996/1 "2015-06-19T14:15:28Z")

</div>

I have a query like below to search and I want to cache it without using filter.  
The code below works well but i could not use "\_cache":true with it.

```json
{
  "query": {
    "bool": {
      "should": [
        {
          "match": {
            "keywords": "heart"
          }
        },
        {
          "match": {
            "treatment_name": "heart"
          }
        },
        {
          "wildcard": {
            "keywords": "heart*"
          }
        },
        {
          "wildcard": {
            "treatment_name": "heart*"
          }
        },
        {
          "fuzzy": {
            "keywords": "heart"
          }
        },
        {
          "fuzzy": {
            "treatment_name": "heart"
          }
        }
      ],
      "minimum_should_match": 2
    }
  }
}

```

The second code works too but the result does not have any score, which is very much required.

```json
{
  "filter": {
    "fquery": {
      "query": {
        "bool": {
          "should": [
            {
              "match": {
                "keywords": "heart"
              }
            },
            {
              "match": {
                "treatment_name": "heart"
              }
            },
            {
              "wildcard": {
                "keywords": "heart*"
              }
            },
            {
              "wildcard": {
                "treatment_name": "heart*"
              }
            },
            {
              "fuzzy": {
                "keywords": "heart"
              }
            },
            {
              "fuzzy": {
                "treatment_name": "heart"
              }
            }
          ],
          "minimum_should_match": 2
        }
      },
      "_cache": true
    }
  }
}

```

Please help.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:06am UTC](https://discuss.elastic.co/t/cache-a-bool-query-without-filter/23996/2 "2017-07-06T00:06:26Z")

</div>


