# MatchPhrase with zero terms

**URL:** <https://discuss.elastic.co/t/matchphrase-with-zero-terms/125211>\
**Category:** Elasticsearch\
**Created:** [March 22, 2018, 2:40pm UTC](https://discuss.elastic.co/t/matchphrase-with-zero-terms/125211 "2018-03-22T14:40:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens\_Fogh](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@Jens\_Fogh](https://discuss.elastic.co/u/Jens_Fogh)\
**Post date:** [March 22, 2018, 2:40pm UTC](https://discuss.elastic.co/t/matchphrase-with-zero-terms/125211/1 "2018-03-22T14:40:21Z")

</div>

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.html)  
[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)

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 🙂

---

<div class="post-metadata">

**Author:** ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)\
**Post date:** [March 30, 2018, 1:28pm UTC](https://discuss.elastic.co/t/matchphrase-with-zero-terms/125211/2 "2018-03-30T13:28:17Z")

</div>

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 ?

---

<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:** [April 27, 2018, 1:28pm UTC](https://discuss.elastic.co/t/matchphrase-with-zero-terms/125211/3 "2018-04-27T13:28:21Z")

</div>

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