Searching non-indexed fields throwing error

we have some fields which are marked as below
old version

"field1": {
            "type": "string",
            "index": "no"
          }

v8

"field1": {
          "type": "text",
          "index": false
        }

earlier in older version it used to send empty response without any exception but now when we search in the new ES version its throwing one exception Cannot search on field [field1] since it is not indexed

is there any recommendations to handle this scenario or is there any config available to suppress this behaviour(something similar to ignore_unmapped )

What is the query?

@dadoonet

{
    "bool": {
        "must": [
            {
                "bool": {
                    "must": [
                        {
                            "dis_max": {
                                "queries": [
                                    {
                                        "bool": {
                                            "must": {
                                                "match": {
                                                    "field1": {
                                                        "query": "test",
                                                        "operator": "OR",
                                                        "boost": 2.0,
                                                        "max_expansions": 10
                                                    }
                                                }
                                            }
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Why do you want to search within a field that you made non searchable?

@dadoonet we have dynamic templates to have mappings to the fields which are not recognised and we mark them as non-indexed fields, even though these fields are not indexed users can still go ahead and search on these dynamic fields.

this is the reason why i am ending up in this situation.

Your best chance is to mark them as searchable I guess.