private BaseFilter _GeoDistanceRange(PropertyPathMarker field, Action <GeoDistanceRangeFilterDescriptor> filterDescriptor) { var filter = new GeoDistanceRangeFilterDescriptor(); if (filterDescriptor != null) { filterDescriptor(filter); } return(this.SetDictionary("geo_distance_range", field, filter, (d, b) => { var dd = new Dictionary <PropertyPathMarker, object>(); dd.Add("from", filter._FromDistance); dd.Add("to", filter._ToDistance); if (!string.IsNullOrWhiteSpace(filter._GeoUnit)) { dd.Add("distance_type", filter._GeoUnit); } if (!string.IsNullOrWhiteSpace(filter._GeoOptimizeBBox)) { dd.Add("optimize_bbox", filter._GeoOptimizeBBox); } d.ForEachWithIndex((kv, i) => dd.Add(kv.Key, kv.Value)); dd[field] = filter._Location; b.GeoDistanceRangeFilter = dd; })); }
public MultiMatchQueryDescriptor <T> OnFieldsWithBoost(Action <FluentDictionary <string, double?> > boostableSelector) { var d = new FluentDictionary <string, double?>(); boostableSelector(d); ((IMultiMatchQuery)this).Fields = d.Select(o => PropertyPathMarker.Create(o.Key, o.Value)); return(this); }
private BaseFilter _GeoPolygon(PropertyPathMarker fieldName, string[] points) { var filter = new GeoPolygonFilter { Points = points }; return(this.SetDictionary("geo_polygon", fieldName, filter, (d, b) => { b.GeoPolygonFilter = d; })); }
private FilterContainer _GeoPolygon(PropertyPathMarker fieldName, string[] points) { IGeoPolygonFilter filter = new GeoPolygonFilterDescriptor(); filter.Points = points; filter.Field = fieldName; return(this.New(filter, f => f.GeoPolygon = filter)); }
public MultiMatchQueryDescriptor <T> OnFieldsWithBoost(Action <FluentDictionary <Expression <Func <T, object> >, double?> > boostableSelector) { var d = new FluentDictionary <Expression <Func <T, object> >, double?>(); boostableSelector(d); this._Fields = d.Select(o => PropertyPathMarker.Create(o.Key, o.Value)); return(this); }
/// <summary> /// A query that match on any (configurable) of the provided terms. This is a simpler syntax query for using a bool query with several term queries in the should clauses. /// </summary> public QueryContainer Terms <K>(Expression <Func <T, IEnumerable <K> > > objectPath, IEnumerable <K> terms) { PropertyPathMarker field = objectPath; return(this.TermsDescriptor <K>(t => t .OnField(field) .Terms(terms) )); }
public string PropertyPath(PropertyPathMarker marker) { if (marker.IsConditionless()) return null; var name = !marker.Name.IsNullOrEmpty() ? marker.Name : this.PropertyNameResolver.Resolve(marker.Type); if (marker.Boost.HasValue) name += "^" + marker.Boost.Value.ToString(CultureInfo.InvariantCulture); return name; }
private BaseFilter _GeoIndexedShape(PropertyPathMarker field, Action <GeoIndexedShapeFilterDescriptor> filterDescriptor) { var filter = new GeoIndexedShapeFilterDescriptor(); if (filterDescriptor != null) { filterDescriptor(filter); } return(this.SetDictionary("geo_shape", field, filter, (d, b) => { b.GeoShapeFilter = d; })); }
private FilterContainer _GeoIndexedShape(PropertyPathMarker field, Action <GeoIndexedShapeFilterDescriptor> filterDescriptor) { var filter = new GeoIndexedShapeFilterDescriptor(); if (filterDescriptor != null) { filterDescriptor(filter); } ((IGeoIndexedShapeFilter)filter).Field = field; return(this.New(filter, f => f.GeoShape = filter)); }
private TermsLookupFilterDescriptor _Lookup <T>(PropertyPathMarker field, string id, string index, string type) { ((ITermsLookupFilter)this).Path = field; ((ITermsLookupFilter)this).Id = id; ((ITermsLookupFilter)this).Type = type ?? new TypeNameMarker { Type = typeof(T) }; ((ITermsLookupFilter)this).Index = index ?? new IndexNameMarker { Type = typeof(T) }; return(this); }
private FilterContainer _GeoHashCell(PropertyPathMarker field, Action <GeoHashCellFilterDescriptor> filterDescriptor) { var filter = new GeoHashCellFilterDescriptor(); if (filterDescriptor != null) { filterDescriptor(filter); } IGeoHashCellFilter ff = filter; ff.Field = field; return(New(filter, f => f.GeoHashCell = filter)); }
private FilterContainer _GeoDistanceRange(PropertyPathMarker field, Action <GeoDistanceRangeFilterDescriptor> filterDescriptor) { var filter = new GeoDistanceRangeFilterDescriptor(); if (filterDescriptor != null) { filterDescriptor(filter); } IGeoDistanceRangeFilter ff = filter; ff.Field = field; return(this.New(ff, f => f.GeoDistanceRange = ff)); }
private GeoIndexedShapeFilterDescriptor _SetShape <T>(PropertyPathMarker field, string id, string index, string type) { ((IGeoIndexedShapeFilter)this).IndexedShape = new IndexedGeoShape { Field = field, Id = id, Type = type ?? new TypeNameMarker { Type = typeof(T) }, Index = index ?? new IndexNameMarker { Type = typeof(T) } }; return(this); }
public PercentilesAggregationDescriptor <T> Field(Expression <Func <T, object> > field) { this._Field = field; return(this); }
public DateHistogramAggregationDescriptor <T> Field(string field) { this._Field = field; return(this); }
public TMetricAggregation Field(string field) { this._Field = field; return((TMetricAggregation)this); }
public SignificantTermsAggregationDescriptor <T> Field(Expression <Func <T, object> > field) { this._Field = field; return(this); }
public Ip4RangeAggregationDescriptor <T> Field(string field) { this._Field = field; return(this); }
public TMetricAggregation Field(Expression <Func <T, object> > field) { this._Field = field; return((TMetricAggregation)this); }
public SignificantTermsAggregationDescriptor <T> Field(string field) { this._Field = field; return(this); }
internal static bool IsConditionless(this PropertyPathMarker marker) { return(marker == null || (marker.Name.IsNullOrEmpty() && marker.Type == null)); }
public GeoDistanceAggregationDescriptor <T> Field(Expression <Func <T, object> > field) { this._Field = field; return(this); }
public DateHistogramAggregationDescriptor <T> Field(Expression <Func <T, object> > field) { this._Field = field; return(this); }
public ExternalFieldDeclarationDescriptor <T> Path(string path) { this._Path = path; return(this); }
public MatchQueryDescriptor <T> OnField(Expression <Func <T, object> > objectPath) { this._Field = objectPath; return(this); }
public MatchQueryDescriptor <T> OnField(string field) { this._Field = field; return(this); }
public GeoDistanceAggregationDescriptor <T> Field(string field) { this._Field = field; return(this); }
private BaseFilter SetDictionary( string type, PropertyPathMarker key, object value, Action <Dictionary <PropertyPathMarker, object>, FilterDescriptor <T> > setter ) { setter.ThrowIfNull("setter"); var dictionary = new Dictionary <PropertyPathMarker, object>(); if (key.IsConditionless()) { return(CreateConditionlessFilterDescriptor(dictionary, type)); } dictionary.Add(key, value); if (this._Cache.HasValue) { dictionary.Add("_cache", this._Cache); } if (!string.IsNullOrWhiteSpace(this._Name)) { dictionary.Add("_name", this._Name); } if (!string.IsNullOrWhiteSpace(this._CacheKey)) { dictionary.Add("_cache_key", this._CacheKey); } this.ResetCache(); var bucket = new FilterDescriptor <T> { IsStrict = this.IsStrict, IsVerbatim = this.IsVerbatim }; setter(dictionary, bucket); if (this.IsVerbatim) { return(bucket); } //find out if we are conditionless if (value == null) { return(CreateConditionlessFilterDescriptor(dictionary, type)); } else if (value is string) { if (string.IsNullOrEmpty(value.ToString())) { return(CreateConditionlessFilterDescriptor(value, type)); } } else if (value is IEnumerable <BaseFilter> ) { var l = (IEnumerable <object>)value; var baseFilters = l.OfType <BaseFilter>().ToList(); var allBaseFiltersConditionless = baseFilters.All(b => b.IsConditionless); if (!baseFilters.HasAny() || allBaseFiltersConditionless) { return(CreateConditionlessFilterDescriptor(dictionary, type)); } } else if (value is IEnumerable <string> ) { var l = (IEnumerable <string>)value; var strings = l.ToList(); var allStringsNullOrEmpty = strings.All(s => s.IsNullOrEmpty()); if (!strings.HasAny() || allStringsNullOrEmpty) { return(CreateConditionlessFilterDescriptor(dictionary, type)); } } else if (value is IEnumerable <object> ) { var l = (IEnumerable <object>)value; if (!l.HasAny()) { return(CreateConditionlessFilterDescriptor(dictionary, type)); } } else if (value is FilterBase) { var bf = (FilterBase)value; if (bf.IsConditionless) { return(CreateConditionlessFilterDescriptor(bf, type)); } } else if (value is FilterDescriptor <T> ) { var bf = (FilterDescriptor <T>)value; if (bf.IsConditionless) { return(CreateConditionlessFilterDescriptor(bf, type)); } } else if (value is BaseQuery) { var bf = (BaseQuery)value; if (bf.IsConditionless) { return(CreateConditionlessFilterDescriptor(bf, type)); } } if (key.IsConditionless()) { return(CreateConditionlessFilterDescriptor(value, type)); } return(bucket); }
public MissingAggregationDescriptor <T> Field(string field) { this._Field = field; return(this); }
public ExternalFieldDeclarationDescriptor <T> Path(Expression <Func <T, object> > objectPath) { this._Path = objectPath; return(this); }