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()
247
247
public void TypeTest ( )
248
248
{
249
249
this . DoConditionlessFilter ( f => f . Type ( string . Empty ) ) ;
250
- this . DoConditionlessFilter ( f => f . Type ( null ) ) ;
250
+ this . DoConditionlessFilter ( f => f . Type ( ( string ) null ) ) ;
251
251
}
252
252
253
-
254
-
255
253
}
256
254
}
Original file line number Diff line number Diff line change 2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
4
using System . Text ;
5
+ using Nest . Resolvers ;
5
6
using Newtonsoft . Json ;
6
7
7
8
namespace Nest
@@ -18,6 +19,6 @@ internal override bool IsConditionless
18
19
}
19
20
20
21
[ JsonProperty ( PropertyName = "value" ) ]
21
- public string Value { get ; set ; }
22
+ public TypeNameMarker Value { get ; set ; }
22
23
}
23
24
}
Original file line number Diff line number Diff line change @@ -549,6 +549,23 @@ public BaseFilter Type(string type)
549
549
this . TypeFilter = filter ;
550
550
return new FilterDescriptor < T > ( ) { TypeFilter = filter } ;
551
551
}
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
+
552
569
/// <summary>
553
570
/// A filter that matches on all documents.
554
571
/// </summary>
You can’t perform that action at this time.
0 commit comments