Weird validation behaviour with allow_leading_wildcard

The following query:

{
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "query": "*Created",
                        "allow_leading_wildcard": false
                    }
                },
                {
                    "range": {
                        "userid": {
                            "from": 1,
                            "to": 2
                        }
                    }
                }
            ]
        }
    }
}

throws a parse_exception on the leading wildcard, which makes sense. But if I change the field name in the range element to a field that does not exist:

{
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "query": "*Created",
                        "allow_leading_wildcard": false
                    }
                },
                {
                    "range": {
                        "NO_SUCH_FIELD": {
                            "from": 1,
                            "to": 2
                        }
                    }
                }
            ]
        }
    }
}

I get a 200 response with zero hits.
This seems counter-intuitive. It looks like the leading wildcard query was executed, when in fact it was not. Is this intentional?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.