# Filter with multiple string queries with wildcard

**URL:** <https://discuss.elastic.co/t/filter-with-multiple-string-queries-with-wildcard/240432>\
**Category:** Elasticsearch\
**Created:** [July 8, 2020, 9:41pm UTC](https://discuss.elastic.co/t/filter-with-multiple-string-queries-with-wildcard/240432 "2020-07-08T21:41:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okemu](https://avatars.discourse-cdn.com/v4/letter/o/e9bcb4/32.png) [@okemu](https://discuss.elastic.co/u/okemu)\
**Post date:** [July 8, 2020, 9:41pm UTC](https://discuss.elastic.co/t/filter-with-multiple-string-queries-with-wildcard/240432/1 "2020-07-08T21:41:32Z")

</div>

Hello, I'm new to Elasticsearch and would greatly appreciate help on this

In the query below I only want the first document to be returned, but instead both documents are returned. How can I write a query to allow wildcards on both strings, but only return documents that match?

```auto
POST /pr/_doc/1
{
  "type": "Type ONE",
  "currency":"USD"
}

POST /pr/_doc/2
{
  "type": "Type TWO",
  "currency":"USD"
}

GET /pr/_search
{
  "query": {
      "bool": {
        "must": [
          {
            "simple_query_string": {
              "query": "Type ON*",
              "fields": ["type"],
              "analyze_wildcard": true
            }
          },
          {
            "simple_query_string": {
              "query": "US*",
              "fields": ["currency"],
              "analyze_wildcard":true
            }
          }
        ]
    }
  }
}

```

---

<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:** [August 5, 2020, 9:41pm UTC](https://discuss.elastic.co/t/filter-with-multiple-string-queries-with-wildcard/240432/2 "2020-08-05T21:41:33Z")

</div>

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