MatchPhrase with zero terms

When you write a phrasequery in the "old" way as this:

{"match":{"":{"query":"","zero_terms_query":"all","type":"phrase"}}}]}}

It is possible to use "zero_terms_query":"all"

But if I use

{"match_phrase":{"":{"query":"}}}

it is not possible as far as I can see.
The zero_terms possibility is only mentioned in the "match-query" documentation, but not the "match-query-phrase".

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-phrase.html

Can this be right? and if it is, what is the thoughts behind this?
I can not use the "old" way to write it, as this gives a deprecated warning.

The problem came after I updated NEST from version 5.3 to version 6.0.2, as Version 5.3 mapped MatchPhraseQuery in the old way to a match query with type "phrase" - giving me the deprecated warning.
And I cant find a way to specify "zero_terms" for my MatchPhraseQuery after updating NEST.

Hope someone can help :slight_smile:

This is not supported by the match_phrase query, I don't think this was intentional though, it's just something we missed during the removal of the type option. Can you open an issue on github ?

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