private void WriteValues(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
        {
            JsonHelper.WriteValue("field", _field, elasticsearchCrudJsonWriter);

            JsonHelper.WriteValue("size", _size, elasticsearchCrudJsonWriter, _sizeSet);
            JsonHelper.WriteValue("shard_size", _shardSize, elasticsearchCrudJsonWriter, _shardSizeSet);
            JsonHelper.WriteValue("min_doc_count", _minDocCount, elasticsearchCrudJsonWriter, _minDocCountSet);
            JsonHelper.WriteValue("shard_min_doc_count", _shardMinDocCount, elasticsearchCrudJsonWriter, _shardMinDocCountSet);
            if (_includeSet)
            {
                _include.WriteJson(elasticsearchCrudJsonWriter);
            }
            if (_excludeSet)
            {
                _exclude.WriteJson(elasticsearchCrudJsonWriter);
            }

            JsonHelper.WriteValue("execution_hint", _executionHint.ToString(), elasticsearchCrudJsonWriter, _executionHintSet);

            if (_backgroundFilterSet)
            {
                elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("background_filter");
                elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
                _backgroundFilter.WriteJson(elasticsearchCrudJsonWriter);
                elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
            }

            if (_informationRetrievalSet)
            {
                _informationRetrieval.WriteJson(elasticsearchCrudJsonWriter);
            }
        }
Exemple #2
0
        private void WriteValues(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
        {
            JsonHelper.WriteValue("field", _field, elasticsearchCrudJsonWriter);

            JsonHelper.WriteValue("size", _size, elasticsearchCrudJsonWriter, _sizeSet);
            JsonHelper.WriteValue("shard_size", _shardSize, elasticsearchCrudJsonWriter, _shardSizeSet);
            if (_orderSet)
            {
                _order.WriteJson(elasticsearchCrudJsonWriter);
            }
            JsonHelper.WriteValue("min_doc_count", _minDocCount, elasticsearchCrudJsonWriter, _minDocCountSet);
            JsonHelper.WriteValue("shard_min_doc_count", _shardMinDocCount, elasticsearchCrudJsonWriter, _shardMinDocCountSet);
            if (_includeSet)
            {
                _include.WriteJson(elasticsearchCrudJsonWriter);
            }
            if (_excludeSet)
            {
                _exclude.WriteJson(elasticsearchCrudJsonWriter);
            }
            JsonHelper.WriteValue("collect_mode", _collectMode.ToString(), elasticsearchCrudJsonWriter, _collectModeSet);
            JsonHelper.WriteValue("execution_hint", _executionHint.ToString(), elasticsearchCrudJsonWriter, _executionHintSet);

            if (_scriptSet)
            {
                elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("script");
                elasticsearchCrudJsonWriter.JsonWriter.WriteRawValue("\"" + _script + "\"");
                if (_paramsSet)
                {
                    elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("params");
                    elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();

                    foreach (var item in _params)
                    {
                        elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(item.ParameterName);
                        elasticsearchCrudJsonWriter.JsonWriter.WriteValue(item.ParameterValue);
                    }
                    elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
                }
            }
        }