# Using wildcard and must\_not to search

**URL:** <https://discuss.elastic.co/t/using-wildcard-and-must-not-to-search/323236>\
**Category:** Elasticsearch\
**Created:** [January 16, 2023, 10:36am UTC](https://discuss.elastic.co/t/using-wildcard-and-must-not-to-search/323236 "2023-01-16T10:36:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![geeky\_human](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@geeky\_human](https://discuss.elastic.co/u/geeky_human)\
**Post date:** [January 16, 2023, 10:36am UTC](https://discuss.elastic.co/t/using-wildcard-and-must-not-to-search/323236/1 "2023-01-16T10:36:49Z")

</div>

Hi,

I’m new to ELK. For searching, I’m using dev tools in kibana. I want to find all the results that do not match a wildcard term.

```auto
"must_not": [
    {"wildcard": {
      "agent.keyword": {"value":"python*"}
    }}]

```

It returns "_[must\_not] query malformed, no start\_object after query name_"

Can we use must\_not with wildcard statement?

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [January 16, 2023, 11:12am UTC](https://discuss.elastic.co/t/using-wildcard-and-must-not-to-search/323236/2 "2023-01-16T11:12:27Z")

</div>

Hi @geeky_human

Are you using the "must\_not" inside the Bool Query?

```auto
{
  "query": {
    "bool": {
      "must_not": [
        {
          "wildcard": {
            "agent.keyword": {
              "value": "python*"
            }
          }
        }
      ]
    }
  }
}

```

---

<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:** [February 13, 2023, 11:13am UTC](https://discuss.elastic.co/t/using-wildcard-and-must-not-to-search/323236/3 "2023-02-13T11:13:19Z")

</div>

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