Elasticsearch template in Logstash doesn't mapping and not able to sort fields

I want to sort datas via elasticsearch rest client, I want to get data that match with the name "match_field", after this match sort via "int_var", below is my template in logstash.

{
  "index_patterns": ["index_name"],
  "template": {
    "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
    },
    "mappings": {
      "_doc": {
          "properties": {
              "int_var": {
                  "type": "keyword"
              }
          }
      }
    }
  }
}

When I try to reach, with the below code

{
        "size": 100,
        "query": {
            "bool": {
                "must": {
                    "match": {
                        "match_field": user_request
                    }
                }
            }
        },
        "sort": [
            {"int_var": {"order": "asc"}}
        ]
    }

I've got this error

Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true

How can i solve this ? Thanks for answering