[match] query does not support [type]


#1

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?


(Mujtaba Hussain) #2

Have you read their post about Removal of mapping types?

This may or may not be helpful :frowning:


#3

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


(Mujtaba Hussain) #4

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


#5

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"]))                            
                )
            )
        )

(David Pilato) #6

Do you have the json version of those?


#7

I don't. I currently exclusively use NEST.


(David Pilato) #8

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.


#9

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"
               }
            }
         }
      ]
   }
}

(David Pilato) #10

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


#11

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


(David Pilato) #12

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


#13

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


(David Pilato) #14

I suppose that you upgraded your nest version, right?

@Martijn_Laarman can help hopefully.


(xeraa) #15

Check out the 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?


(Jon Sagara) #16

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


(system) #17

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