Beispiel #1
0
 static ElasticClient()
 {
     SerializationSettings = ElasticClient.CreateSettings();
     PropertyNameResolver  = new PropertyNameResolver(SerializationSettings);
 }
        /// <summary>
        /// Filters documents that have fields that match any of the provided terms (not analyzed).
        /// </summary>
        public BaseFilter Terms(Expression <Func <T, object> > fieldDescriptor, IEnumerable <string> terms, TermsExecution?Execution = null)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.Terms(field, terms, Execution));
        }
        /// <summary>
        /// Filter documents indexed using the geo_shape type.
        /// </summary>
        public BaseFilter TermsLookup(Expression <Func <T, object> > fieldDescriptor, Action <TermsLookupFilterDescriptor> filterDescriptor)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.TermsLookup(field, filterDescriptor));
        }
        /// <summary>
        /// Filters documents that have fields containing terms with a specified prefix
        /// (not analyzed). Similar to phrase query, except that it acts as a filter.
        /// </summary>
        public BaseFilter Prefix(Expression <Func <T, object> > fieldDescriptor, string prefix)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.Prefix(field, prefix));
        }
        /// <summary>
        /// Filters documents that have fields that contain a term (not analyzed).
        /// Similar to term query, except that it acts as a filter
        /// </summary>
        public BaseFilter Term <K>(Expression <Func <T, K> > fieldDescriptor, K term)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.Term(field, term));
        }
Beispiel #6
0
 public TypeMappingWriter(string typeName, PropertyNameResolver propertyNameResolver)
 {
     this.TypeName             = typeName;
     this.PropertyNameResolver = propertyNameResolver;
 }
        /// <summary>
        /// A filter allowing to include hits that only fall within a polygon of points.
        /// </summary>
        public BaseFilter GeoPolygon(Expression <Func <T, object> > fieldDescriptor, params string[] points)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.GeoPolygon(field, points));
        }
        /// <summary>
        /// A filter allowing to filter hits based on a point location using a bounding box
        /// </summary>
        public BaseFilter GeoBoundingBox(Expression <Func <T, object> > fieldDescriptor, double topLeftX, double topLeftY, double bottomRightX, double bottomRightY, GeoExecution?Type = null)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.GeoBoundingBox(field, topLeftX, topLeftY, bottomRightX, bottomRightY, Type));
        }
        /// <summary>
        /// Filter documents indexed using the geo_shape type.
        /// </summary>
        public BaseFilter GeoIndexedShape(Expression <Func <T, object> > fieldDescriptor, Action <GeoIndexedShapeFilterDescriptor> filterDescriptor)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.GeoIndexedShape(field, filterDescriptor));
        }
        /// <summary>
        /// Filters documents where a specific field has no value in them.
        /// </summary>
        public BaseFilter Missing(Expression <Func <T, object> > fieldDescriptor)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.Missing(field));
        }
        /// <summary>
        /// A filter allowing to filter hits based on a point location using a bounding box
        /// </summary>
        public BaseFilter GeoBoundingBox(Expression <Func <T, object> > fieldDescriptor, string geoHashTopLeft, string geoHashBottomRight, GeoExecution?Type = null)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.GeoBoundingBox(field, geoHashTopLeft, geoHashBottomRight, Type));
        }
Beispiel #12
0
        public new TermFacetDescriptor <T> Nested(Expression <Func <T, object> > objectPath)
        {
            var fieldName = new PropertyNameResolver().Resolve(objectPath);

            return(this.Nested(fieldName));
        }
Beispiel #13
0
        public NumericRangeFilterDescriptor <T> OnField(Expression <Func <T, object> > objectPath)
        {
            var fieldName = new PropertyNameResolver().Resolve(objectPath);

            return(this.OnField(fieldName));
        }
Beispiel #14
0
 public ElasticSerializer(IConnectionSettings settings)
 {
     this._settings = settings;
     this._serializationSettings = this.CreateSettings();
     this._propertyNameResolver  = new PropertyNameResolver();
 }
Beispiel #15
0
        public NestedQueryDescriptor <T> Path(Expression <Func <T, object> > objectPath)
        {
            var fieldName = new PropertyNameResolver().Resolve(objectPath);

            return(this.Path(fieldName));
        }
        /// <summary>
        /// A filter allowing to include hits that only fall within a polygon of points.
        /// </summary>
        public BaseFilter GeoPolygon(Expression <Func <T, object> > fieldDescriptor, IEnumerable <Tuple <double, double> > points)
        {
            var field = new PropertyNameResolver().Resolve(fieldDescriptor);

            return(this.GeoPolygon(field, points));
        }
Beispiel #17
0
        public RegexpQueryDescriptor <T> OnField(Expression <Func <T, object> > objectPath)
        {
            var fieldName = new PropertyNameResolver().Resolve(objectPath);

            return(this.OnField(fieldName));
        }
Beispiel #18
0
        public TermsLookupFilterDescriptor Lookup <T>(Expression <Func <T, object> > field, string id, string index = null, string type = null)
        {
            var fieldName = new PropertyNameResolver().Resolve(field);

            return(this.Lookup <T>(fieldName, id, index, type));
        }