# Weird validation behaviour with allow\_leading\_wildcard

**URL:** <https://discuss.elastic.co/t/weird-validation-behaviour-with-allow-leading-wildcard/257374>\
**Category:** Elasticsearch\
**Created:** [December 2, 2020, 3:09pm UTC](https://discuss.elastic.co/t/weird-validation-behaviour-with-allow-leading-wildcard/257374 "2020-12-02T15:09:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barakm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/barakm/32/64645_2.png) [@barakm](https://discuss.elastic.co/u/barakm)\
**Post date:** [December 2, 2020, 3:09pm UTC](https://discuss.elastic.co/t/weird-validation-behaviour-with-allow-leading-wildcard/257374/1 "2020-12-02T15:09:38Z")

</div>

The following query:

```auto
{
    "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:

```auto
{
    "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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 30, 2020, 3:09pm UTC](https://discuss.elastic.co/t/weird-validation-behaviour-with-allow-leading-wildcard/257374/2 "2020-12-30T15:09:54Z")

</div>

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