Node Query Cache with keyword

For search performance, changing field type of integer/long to keywords for term querys might increase search speed.

However, I recently found that doing this change would no longer getting benefit from node query cache in a filter context

Is there any solution can reuse node query cache?

Appreciating any answer

Query DSL would be like as below:

GET  myindex/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "myfield": "666"
          }
        }
      ]
    }
  }
}

when "myfield" is a type of "integer" , the query_cache would be increased from calling:
GET myindex/_stats

But when I change the type of integer to a keyword, the cache no longer working

solved by myself

GET myindex/_search
{
  
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "must": [
              {
                "term": {
                  "field1": "666"
                }
              }
            ],
            "should": [
              {
                "term": {
                  "field1": "666"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

look like ugly but it did help

The magic is . Within a filter context:

Term query with numeric type will be solved as PointRangeQuery in Lucence(covered in node query cache)

while, Term query with keyword type will be plainly solved as TermQuery in Lucnce(not cached)

The solution is, Instead of using term query directly, you can use a boolean query with multiply conditions(term queries each), So Elasticsearch treats boolean query as BooleanQuery in lucence in a whole, and using node query cache again(BooleanQuery would be cached)