# Wildcard conflicting

**URL:** <https://discuss.elastic.co/t/wildcard-conflicting/300870>\
**Category:** Elasticsearch\
**Created:** [March 28, 2022, 3:44pm UTC](https://discuss.elastic.co/t/wildcard-conflicting/300870 "2022-03-28T15:44:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlivierC](https://avatars.discourse-cdn.com/v4/letter/o/4491bb/32.png) [@OlivierC](https://discuss.elastic.co/u/OlivierC)\
**Post date:** [March 28, 2022, 3:44pm UTC](https://discuss.elastic.co/t/wildcard-conflicting/300870/1 "2022-03-28T15:44:50Z")

</div>

Hello,

I try to find a query for something looking easy for a human, but I can't create it with ES.

Let's imagine we have an index named words with a few data:

```auto
PUT words/_doc/1
{
  "name": "elastic"
}
PUT words/_doc/2
{
  "name": "delete"
}
PUT words/_doc/3
{
  "name": "dagger"
}
PUT words/_doc/4
{
  "name": "daily"
}
PUT words/_doc/5
{
  "name": "dark"
}
PUT words/_doc/6
{
  "name": "darth"
}

```

Is it possible to get every words starting by **"d"** , but not starting by **"da"** except for those starting by **"dar"**? In my example, I must have the following list:

- delete
- dark
- darth

I tried something like that but it doesn't work:

```auto
GET /words/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "wildcard": {
            "name": {
              "value": "d*"
            }
          }
        },
        {
          "wildcard": {
            "name": {
              "value": "dar*"
            }
          }
        }
      ],
      "must_not": [
        {
          "wildcard": {
            "name": {
              "value": "da*"
            }
          }
        }
      ]
    }
  }
}

```

Thanks!

---

<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:** [April 25, 2022, 3:45pm UTC](https://discuss.elastic.co/t/wildcard-conflicting/300870/2 "2022-04-25T15:45:08Z")

</div>

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