2016-07-25 64 views
0

我需要在窩1.7與數值加rangerfilter,使用範圍與數值窩1.7

但是類定義GREATERTHAN用繩子

namespace Nest 
{ 
    public class RangeFilter : PlainFilter, IRangeFilter, IFieldNameFilter, IFilter 
    { 
     public RangeFilter(); 

     public RangeExecution? Execution { get; set; } 
     public PropertyPathMarker Field { get; set; } 
     public string Format { get; set; } 
     public string GreaterThan { get; set; } 
     public string GreaterThanOrEqualTo { get; set; } 
     public string LowerThan { get; set; } 
     public string LowerThanOrEqualTo { get; set; } 
     public string TimeZone { get; set; } 

     protected internal override void WrapInContainer(IFilterContainer container); 
    } 
} 

所以我的查詢是

{ 
        "range": { 
         "NbAnnonce": { 
         "gt": "0" 
         } 

,而不是

{ 
       "range": { 
        "NbAnnonce": { 
        "gt": 0.0 
        } 

我該如何解決這個問題?

回答

0

你可以試試這個

new NumericRangeQuery 
{ 
    Name = "named_query", 
    Boost = 1.1, 
    Field = "description", 
    GreaterThan = 1.0, 
    GreaterThanOrEqualTo = 1.1, 
    LessThan = 2.1, 
    LessThanOrEqualTo = 2.0 
} 

JSON輸出

{ 
    "range": { 
    "description": { 
     "_name": "named_query", 
     "boost": 1.1, 
     "gt": 1.0, 
     "gte": 1.1, 
     "lt": 2.1, 
     "lte": 2.0 
    } 
    } 
}