# \[match\] query does not support \[type\]

**URL:** <https://discuss.elastic.co/t/match-query-does-not-support-type/111667>\
**Category:** Elasticsearch\
**Created:** [December 14, 2017, 12:11am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667 "2017-12-14T00:11:43Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 12:11am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/1 "2017-12-14T00:11:43Z")

</div>

Hey all,

After upgrading to a new cluster running Elasticsearch 6.0, from a cluster running 5.4, I'm running into a persistent 400 Error with the message when attempting to run my previously-working Query on the new cluster:

> parsing\_exception Reason: [match] query does not support [type]

I've attempted to add the lenient flag to all of my Match queries, but it has made no difference. Any insight?

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [December 14, 2017, 2:34am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/2 "2017-12-14T02:34:14Z")

</div>

Have you read their post about [Removal of mapping types](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html)?

This may or may not be helpful ☹

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 2:51am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/3 "2017-12-14T02:51:24Z")

</div>

I'm only storing one type of document per index, so it's not completely applicable.

---

<div class="post-metadata">

**Author:** ![mujtabahussain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mujtabahussain/32/17514_2.png) [@mujtabahussain](https://discuss.elastic.co/u/mujtabahussain)\
**Post date:** [December 14, 2017, 2:55am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/4 "2017-12-14T02:55:02Z")

</div>

Sure. Are you able to post the query here? And perhaps the mapping of the index?

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 3:21pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/5 "2017-12-14T15:21:15Z")

</div>

Here's the query:

> ```
> .Query(q => q
> .Bool( b => b
> .Should(s => s
> .MatchPhrase(m => m
> .Query(searchTerm)
> .Field(fi => fi.Items.First().Id)
> .Lenient(true)),                           
> s => s
> .Match(m =>m
> .Query(date)
> .Field(fi => fi.CustomAttributes["Expiration"])
> .Lenient(true)),
> s => s
> .Fuzzy(f => f
> .Value(searchTerm)
> .Field(fi => fi.Items.First().Cat)
> ),
> s => s
> .MatchPhrase(c => c
> .Query(searchTerm)
> .Field(fi => fi.Name)
> .Analyzer("synonym_analyzer")
> .Fuzziness(Fuzziness.EditDistance(2))
> .Lenient(true)
> ),
> s => s.
> MatchPhrasePrefix(p => p
> .Field(fi => fi.Name)
> .Query(searchTerm)
> .Analyzer("synonym_analyzer")
> .Boost(0.8)
> .Lenient(true))
> )))
> 
> ```

And here's the mapping:

> ```
> .Mappings(m => m
> .Map<Item>(u => u
> .Properties(p => p
> .Text(t => t.Name(n => n.Name)
> .IndexOptions(IndexOptions.Positions)
> .Analyzer("synonym_analyzer")
> )
> .Text(t => t.Name(n => n.Items.First().Cat))
> .Text(t => t.Name(n => n.Items.First().Id))
> .Text(t => t.Name(n => n.CustomAttributes["Expiration"]))                            
> )
> )
> )
> 
> ```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2017, 3:42pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/6 "2017-12-14T15:42:20Z")

</div>

Do you have the json version of those?

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 4:01pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/7 "2017-12-14T16:01:33Z")

</div>

I don't. I currently exclusively use NEST.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2017, 4:23pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/8 "2017-12-14T16:23:01Z")

</div>

Do you mean that you can't debug with .Net what is generated and sent over the network?

If you can't I can't help sorry. May be someone else can though.

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 7:26pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/9 "2017-12-14T19:26:04Z")

</div>

I really wish Nest had more straightforward support for Query extraction, but here's what I managed to come up with:

> ```
> {
> "bool":{
> "should":[
> {
> "match":{
> "Items.Id":{
> "type":"phrase",
> "query":"hydrogenated polybutene (370 mw)"
> }
> }
> },
> {
> "fuzzy":{
> "Items.Cat":{
> "value":"hydrogenated polybutene (370 mw)"
> }
> }
> },
> {
> "match":{
> "name":{
> "type":"phrase",
> "query":"hydrogenated polybutene (370 mw)",
> "analyzer":"synonym_analyzer",
> "fuzziness":2
> }
> }
> },
> {
> "match":{
> "name":{
> "boost":0.8,
> "type":"phrase_prefix",
> "query":"hydrogenated polybutene (370 mw)",
> "analyzer":"synonym_analyzer"
> }
> }
> }
> ]
> }
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2017, 9:49pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/10 "2017-12-14T21:49:56Z")

</div>

Thanks. Have a look at [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 11:10pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/11 "2017-12-14T23:10:35Z")

</div>

Is the existence of the "type" field in the query the cause of the error?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 14, 2017, 11:29pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/12 "2017-12-14T23:29:38Z")

</div>

Yes. This old option does not exist. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html)

---

<div class="post-metadata">

**Author:** ![DiskElemental](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@DiskElemental](https://discuss.elastic.co/u/DiskElemental)\
**Post date:** [December 14, 2017, 11:31pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/13 "2017-12-14T23:31:50Z")

</div>

Which means Nest is completely incompatible with ElasticSearch 6.0; because as shown in my code, I'm using the appropriate functions.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 15, 2017, 9:01am UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/14 "2017-12-15T09:01:55Z")

</div>

I suppose that you upgraded your nest version, right?

@Martijn_Laarman can help hopefully.

---

<div class="post-metadata">

**Author:** ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)\
**Post date:** [December 16, 2017, 9:06pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/15 "2017-12-16T21:06:36Z")

</div>

Check out the compatibility matrix: [https://github.com/elastic/elasticsearch-net#compatibility-matrix](https://github.com/elastic/elasticsearch-net#compatibility-matrix)

The beta1 of NEST for Elasticsearch 6.x has just come out, so that's your best option at the moment. I assume you're still on a stable NEST version, which is only compatible with 5.x, right?

---

<div class="post-metadata">

**Author:** ![jonsagara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonsagara/32/26170_2.png) [@jonsagara](https://discuss.elastic.co/u/jonsagara)\
**Post date:** [January 2, 2018, 9:35pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/16 "2018-01-02T21:35:08Z")

</div>

FWIW, NEST 6.0.0-rc1 resolved this issue for me.

---

<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:** [January 30, 2018, 9:35pm UTC](https://discuss.elastic.co/t/match-query-does-not-support-type/111667/17 "2018-01-30T21:35:08Z")

</div>

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