diff --git a/src/Nest/QueryDsl/FullText/MatchPhrasePrefix/MatchPhrasePrefixQuery.cs b/src/Nest/QueryDsl/FullText/MatchPhrasePrefix/MatchPhrasePrefixQuery.cs index 2038a5d0ae2..5e974d1b61e 100644 --- a/src/Nest/QueryDsl/FullText/MatchPhrasePrefix/MatchPhrasePrefixQuery.cs +++ b/src/Nest/QueryDsl/FullText/MatchPhrasePrefix/MatchPhrasePrefixQuery.cs @@ -18,6 +18,15 @@ public interface IMatchPhrasePrefixQuery : IFieldNameQuery [JsonProperty("slop")] int? Slop { get; set; } + + /// + /// If the analyzer used removes all tokens in a query like a stop filter does, the default behavior is + /// to match no documents at all. In order to change that, can be used, + /// which accepts (default) and + /// which corresponds to a match_all query. + /// + [JsonProperty("zero_terms_query")] + ZeroTermsQuery? ZeroTermsQuery { get; set; } } public class MatchPhrasePrefixQuery : FieldNameQueryBase, IMatchPhrasePrefixQuery @@ -28,6 +37,8 @@ public class MatchPhrasePrefixQuery : FieldNameQueryBase, IMatchPhrasePrefixQuer public int? MaxExpansions { get; set; } public string Query { get; set; } public int? Slop { get; set; } + /// + public ZeroTermsQuery? ZeroTermsQuery { get; set; } internal override void InternalWrapInContainer(IQueryContainer c) => c.MatchPhrasePrefix = this; @@ -44,6 +55,7 @@ public class MatchPhrasePrefixQueryDescriptor string IMatchPhrasePrefixQuery.Analyzer { get; set; } int? IMatchPhrasePrefixQuery.MaxExpansions { get; set; } int? IMatchPhrasePrefixQuery.Slop { get; set; } + ZeroTermsQuery? IMatchPhrasePrefixQuery.ZeroTermsQuery { get; set; } public MatchPhrasePrefixQueryDescriptor Query(string query) => Assign(a => a.Query = query); @@ -52,5 +64,9 @@ public class MatchPhrasePrefixQueryDescriptor public MatchPhrasePrefixQueryDescriptor MaxExpansions(int? maxExpansions) => Assign(a => a.MaxExpansions = maxExpansions); public MatchPhrasePrefixQueryDescriptor Slop(int? slop) => Assign(a => a.Slop = slop); + + /// + public MatchPhrasePrefixQueryDescriptor ZeroTermsQuery(ZeroTermsQuery? zeroTermsQuery) => Assign(a => a.ZeroTermsQuery = zeroTermsQuery); + } }