public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
        {
            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("geo_distance");
            elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();

            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(_field);
            _location.WriteJson(elasticsearchCrudJsonWriter);

            JsonHelper.WriteValue("distance", _distance.GetDistanceUnit(), elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("distance_type", _distanceType.ToString(), elasticsearchCrudJsonWriter, _distanceTypeSet);
            JsonHelper.WriteValue("optimize_bbox", _optimizeBbox.ToString(), elasticsearchCrudJsonWriter, _optimizeBboxSet);

            elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
        }
        protected void WriteValues(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
        {
            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(_decayType);
            elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(_field);
            elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();

            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("origin");
            _origin.WriteJson(elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("offset", _offset, elasticsearchCrudJsonWriter, _offsetSet);
            JsonHelper.WriteValue("scale", _scale.GetDistanceUnit(), elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("decay", _decay, elasticsearchCrudJsonWriter, _decaySet);

            elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
            elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
        }
Esempio n. 3
0
        public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
        {
            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("geo_distance_range");
            elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();

            elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(_field);
            _location.WriteJson(elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("from", _from.GetDistanceUnit(), elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("to", _to.GetDistanceUnit(), elasticsearchCrudJsonWriter);
            JsonHelper.WriteValue("gte", _greaterThanOrEqualTo, elasticsearchCrudJsonWriter, _greaterThanOrEqualToSet);
            JsonHelper.WriteValue("gt", _greaterThan, elasticsearchCrudJsonWriter, _greaterThanSet);
            JsonHelper.WriteValue("lte", _lessThanOrEqualTo, elasticsearchCrudJsonWriter, _lessThanOrEqualToSet);
            JsonHelper.WriteValue("lt", _lessThan, elasticsearchCrudJsonWriter, _lessThanSet);
            JsonHelper.WriteValue("include_lower", _includeLower, elasticsearchCrudJsonWriter, _includeLowerSet);
            JsonHelper.WriteValue("include_upper", _includeUpper, elasticsearchCrudJsonWriter, _includeUpperSet);

            elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
        }