File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Nest.Tests.Unit/Search/Filter/ConditionLess Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -247,10 +247,8 @@ public void TermsTest()
247247 public void TypeTest ( )
248248 {
249249 this . DoConditionlessFilter ( f => f . Type ( string . Empty ) ) ;
250- this . DoConditionlessFilter ( f => f . Type ( null ) ) ;
250+ this . DoConditionlessFilter ( f => f . Type ( ( string ) null ) ) ;
251251 }
252252
253-
254-
255253 }
256254}
Original file line number Diff line number Diff line change 22using System . Collections . Generic ;
33using System . Linq ;
44using System . Text ;
5+ using Nest . Resolvers ;
56using Newtonsoft . Json ;
67
78namespace Nest
@@ -18,6 +19,6 @@ internal override bool IsConditionless
1819 }
1920
2021 [ JsonProperty ( PropertyName = "value" ) ]
21- public string Value { get ; set ; }
22+ public TypeNameMarker Value { get ; set ; }
2223 }
2324}
Original file line number Diff line number Diff line change @@ -549,6 +549,23 @@ public BaseFilter Type(string type)
549549 this . TypeFilter = filter ;
550550 return new FilterDescriptor < T > ( ) { TypeFilter = filter } ;
551551 }
552+
553+ /// <summary>
554+ /// Filters documents matching the provided document / mapping type.
555+ /// Note, this filter can work even when the _type field is not indexed
556+ /// (using the _uid field).
557+ /// </summary>
558+ public BaseFilter Type ( Type type )
559+ {
560+ var filter = new TypeFilter { Value = type } ;
561+ if ( filter . IsConditionless )
562+ return CreateConditionlessFilterDescriptor ( "filter" , filter ) ;
563+
564+ this . SetCacheAndName ( filter ) ;
565+ this . TypeFilter = filter ;
566+ return new FilterDescriptor < T > ( ) { TypeFilter = filter } ;
567+ }
568+
552569 /// <summary>
553570 /// A filter that matches on all documents.
554571 /// </summary>
You can’t perform that action at this time.
0 commit comments