Esempio n. 1
0
        /// <summary>
        /// A filter allowing to filter hits based on a point location using a bounding box
        /// </summary>
        public BaseFilter GeoBoundingBox(string fieldName, string geoHashTopLeft, string geoHashBottomRight, GeoExecution?Type = null)
        {
            var filter = new GeoBoundingBoxFilter {
                TopLeft = geoHashTopLeft, BottomRight = geoHashBottomRight
            };

            return(this.SetDictionary("geo_bounding_box", fieldName, filter, (d, b) =>
            {
                if (Type.HasValue)
                {
                    d.Add("type", Enum.GetName(typeof(GeoExecution), Type.Value));
                }
                b.GeoBoundingBoxFilter = d;
            }));
        }
Esempio n. 2
0
        public void GeoBoundingBox(string fieldName, string geoHashTopLeft, string geoHashBottomRight, GeoExecution?Type = null)
        {
            geoHashTopLeft.ThrowIfNullOrEmpty("geoHashTopLeft");
            geoHashBottomRight.ThrowIfNullOrEmpty("geoHashBottomRight");
            var filter = new GeoBoundingBoxFilter {
                TopLeft = geoHashTopLeft, BottomRight = geoHashBottomRight
            };

            this.SetDictionary(fieldName, filter, (d) => {
                if (Type.HasValue)
                {
                    d.Add("type", Enum.GetName(typeof(GeoExecution), Type.Value));
                }
                this.GeoBoundingBoxFilter = d;
            });
        }