# SOLVED: \[query\_shard\_exception failed to create query with index

**URL:** <https://discuss.elastic.co/t/solved-query-shard-exception-failed-to-create-query-with-index/153972>\
**Category:** Elasticsearch\
**Created:** [October 25, 2018, 10:35am UTC](https://discuss.elastic.co/t/solved-query-shard-exception-failed-to-create-query-with-index/153972 "2018-10-25T10:35:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave\_Clissold](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_clissold/32/30296_2.png) [@Dave\_Clissold](https://discuss.elastic.co/u/Dave_Clissold)\
**Post date:** [October 25, 2018, 10:35am UTC](https://discuss.elastic.co/t/solved-query-shard-exception-failed-to-create-query-with-index/153972/1 "2018-10-25T10:35:15Z")

</div>

I have just started getting a strange failed to create query error, I am running the query though elasticsearch.js. When is tried searching across multiple indexes ['gin','wine','whisky','beer'] it worked as soon as I limit the index to wine I get this follow error

```
[query_shard_exception] failed to create query: {
  "bool" : {
    "should" : [
      {
        "multi_match" : {
          "query" : "Bodega",
          "fields" : [
            "name^2.0",
            "producer^3.0",
            "searchterm^1.0"
          ],
          "type" : "best_fields",
          "operator" : "OR",
          "slop" : 0,
          "fuzziness" : "1",
          "prefix_length" : 0,
          "max_expansions" : 50,
          "zero_terms_query" : "NONE",
          "auto_generate_synonyms_phrase_query" : true,
          "fuzzy_transpositions" : true,
          "boost" : 1.0
        }
      },
      {
        "multi_match" : {
          "query" : "Bodega",
          "fields" : [
            "name^2.0",
            "producer^3.0",
            "searchterm^1.0"
          ],
          "type" : "phrase_prefix",
          "operator" : "OR",
          "slop" : 0,
          "prefix_length" : 0,
          "max_expansions" : 50,
          "zero_terms_query" : "NONE",
          "auto_generate_synonyms_phrase_query" : true,
          "fuzzy_transpositions" : true,
          "boost" : 1.0
        }
      }
    ],
    "adjust_pure_negative" : true,
    "boost" : 1.0
  }
}, with { index_uuid="ASBNyiVeQ1Kcw9elbaWwCg" & index="wine" }
```

---

<div class="post-metadata">

**Author:** ![Dave\_Clissold](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dave_clissold/32/30296_2.png) [@Dave\_Clissold](https://discuss.elastic.co/u/Dave_Clissold)\
**Post date:** [October 25, 2018, 10:38am UTC](https://discuss.elastic.co/t/solved-query-shard-exception-failed-to-create-query-with-index/153972/2 "2018-10-25T10:38:37Z")

</div>

SOLVED: When running the query through postman I get better error messages. Forgot that I had set the searchterm to be a keyword.

---

<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:** [November 22, 2018, 10:46am UTC](https://discuss.elastic.co/t/solved-query-shard-exception-failed-to-create-query-with-index/153972/3 "2018-11-22T10:46:34Z")

</div>

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