Opensearch-py with Search and field keyword

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):

AWS OpenSearch server

Describe the issue:

I am new to OpenSearch, and is writing to query from AWS Open Search server.
When tried to use Search client, I can’t find a way to search for field.keyword instead of just field. For example, to filter out special characters in handler_id such as .MP1234567890, I have this DSL query:

query =  {
    "query": {
        "bool": {
            "must": [
                    "regexp": {
                        "handler_id.keyword": "[^_*\\-\.;?#$%^@!`,\\./?+()~<>:'\\[\\]{}]*"
                    "regexp": {
                        "handler_id.keyword": "[A-Za-z]{2}[a-zA-Z0-9]{2}[0-9]{8}"

This code block with OpenSearch client works:

client = OpenSearch(
    hosts = [{'host': host, 'port': 443}],
    http_auth = auth,
    use_ssl = True,
    verify_certs = True,
    connection_class = RequestsHttpConnection,
    pool_maxsize = 20

response =, index='agg_handlers')

but this block below won’t filter out .MP1234567890.

s = Search(using=client, index='agg_handlers')\
    .filter('regexp', handler_id="[^_*\\-\.;?#$%^@!`,\\./?+()~<>:'\\[\\]{}]*")\
    .filter('regexp', handler_id="[A-Za-z]{2}[a-zA-Z0-9]{2}[0-9]{8}")\
    .sort({order_column_name: {"order": order_direction}})[from_:size_]
response = s.execute()

I tried to read the code and searched in Opensearch forum but couldn’t find anything work. The first query works, but I’d prefer Search client for readability if possible.

Any help or pointers on this issue is greatly appreciated. Thank you