Query_shard_exception and HTTP response codes

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

Open Search 2.11

Describe the issue:

When querying across indexes where the query is valid but the field type does not match, we get query_shard_exceptions in the response. I understand why that would happen. What I don’t understand is that in previous versions, eg. ES 6.4, it returned an HTTP 400. Now that we are using OS 2, it is returning HTTP 200.

Why has the behavior changed?
What is the expected behavior when a query_shard_exception happens?
What is the recommended way to test for errors?
Are there any cluster, index, or query options related to this behavior?

Response:

{
    "took": 6,
    "timed_out": False,
    "_shards": {
        "total": 15,
        "successful": 6,
        "skipped": 0,
        "failed": 9,
        "failures": [
            {
                "shard": 0,
                "index": "$_index_a",
                "node": "0niiG-sdQo2hvNTF99OdUA",
                "reason": {
                    "type": "query_shard_exception",
                    "reason": "failed to create query: Can"t parse boolean value [alex
                    ], expected [
                        true
                    ] or [
                        false
                    ]", "index": "$index_a", "index_uuid": "INmA0sdfsRVGoUuALCFM4SQ", "caused_by": {"type": "illegal_argument_exception", "reason": "Can"t parse boolean value [mytext], expected [true] or [false]"
                }
            }
        },
        {
            "shard": 0,
            "index": "$_index_b",
            "node": "0niiG-sdQo2hvNTF99OdUA",
            "reason": {
                "type": "query_shard_exception",
                "reason": "failed to create query: Can"t parse boolean value [alex
                ], expected [
                    true
                ] or [
                    false
                ]", "index": "$_index_b", "index_uuid": "mZu8c1_dSxOsfssfdEy67Vjg", "caused_by": {"type": "illegal_argument_exception", "reason": "Can"t parse boolean value [mytext], expected [true] or [false]"
            }
        }
    },
    {
        "shard": 0,
        "index": "$_index_c",
        "node": "0niiG-sdQo2hvNTF99OdUA",
        "reason": {
            "type": "query_shard_exception",
            "reason": "failed to create query: Can"t parse boolean value [alex
            ], expected [
                true
            ] or [
                false
            ]", "index": "$_index_c", "index_uuid": "sMPjmEsdfdsGvFT7g4zQ1NA", "caused_by": {"type": "illegal_argument_exception", "reason": "Can"t parse boolean value [mytext], expected [true] or [false]"
        }
    }
}
]
},
"hits": {
"total": 0,
"max_score": None,
"hits": []
}
}

Reference: