# How to get a multi match query to fail gracefully when a field doesn't exist

**URL:** <https://discuss.elastic.co/t/how-to-get-a-multi-match-query-to-fail-gracefully-when-a-field-doesnt-exist/56938>\
**Category:** Elasticsearch\
**Created:** [August 1, 2016, 10:38pm UTC](https://discuss.elastic.co/t/how-to-get-a-multi-match-query-to-fail-gracefully-when-a-field-doesnt-exist/56938 "2016-08-01T22:38:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leeavital](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leeavital/32/11151_2.png) [@leeavital](https://discuss.elastic.co/u/leeavital)\
**Post date:** [August 1, 2016, 10:38pm UTC](https://discuss.elastic.co/t/how-to-get-a-multi-match-query-to-fail-gracefully-when-a-field-doesnt-exist/56938/1 "2016-08-01T22:38:43Z")

</div>

I'm using the following query:

```auto
dis_max: {
   queries: [
     {"multi_match": { "fields": ["b.*"], "text": "foo", "fuzziness": 2},
    {"multi_match": { "fields": ["a"], "text": "foo", "fuzziness": 0}
   ]
}

```

Where `a` is a required field, but `b.*` is not.

It works fine most of the time, but when I start my application from scratch, I can get into a state where nothing under `b` gets indexed. And since I'm using dynamic mappings for `b`, this means that the query fails with:

```auto
! org.elasticsearch.index.query.QueryParsingException: No fields specified for multi_match query

```

I'd like to tell the second multi\_match query to simply not match when the wildcard doesn't expand to any known fields.

Is this possible?

---

<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:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/how-to-get-a-multi-match-query-to-fail-gracefully-when-a-field-doesnt-exist/56938/2 "2017-07-05T22:31:02Z")

</div>


