本文整理汇总了C#中ElasticsearchCrudJsonWriter类的典型用法代码示例。如果您正苦于以下问题:C# ElasticsearchCrudJsonWriter类的具体用法?C# ElasticsearchCrudJsonWriter怎么用?C# ElasticsearchCrudJsonWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ElasticsearchCrudJsonWriter类属于命名空间,在下文中一共展示了ElasticsearchCrudJsonWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("type");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
JsonHelper.WriteValue("value", _type, elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例2: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("indices");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
JsonHelper.WriteListValue("indices", _indices, elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("filter");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_filter.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
if (_noMatchFilterSet)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("no_match_filter");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_noMatchFilter.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
else if (!_noMatchFilterSet && _noMatchFilterNoneSet)
{
JsonHelper.WriteValue("no_match_filter", "none", elasticsearchCrudJsonWriter);
}
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例3: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("script");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
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();
}
JsonHelper.WriteValue("lang", "groovy", elasticsearchCrudJsonWriter);
JsonHelper.WriteValue("_cache", _cache, elasticsearchCrudJsonWriter, _cacheSet);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例4: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
JsonHelper.WriteValue("_index", _index, elasticsearchCrudJsonWriter, _indexSet);
JsonHelper.WriteValue("_type", _type, elasticsearchCrudJsonWriter, _typeSet);
JsonHelper.WriteValue("_id", _id, elasticsearchCrudJsonWriter, _idSet);
JsonHelper.WriteValue("_routing", _routing, elasticsearchCrudJsonWriter, _routingSet);
}
示例5: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("order");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
JsonHelper.WriteValue(_field, _order.ToString(), elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例6: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("sort");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("_script");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("script");
elasticsearchCrudJsonWriter.JsonWriter.WriteRawValue("\"" + _script + "\"");
JsonHelper.WriteValue("order", Order.ToString(), elasticsearchCrudJsonWriter);
JsonHelper.WriteValue("type", _scriptType, elasticsearchCrudJsonWriter, _scriptTypeSet);
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();
}
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例7: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("span_not");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("include");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_include.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("exclude");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_exclude.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
if (_distSet)
{
JsonHelper.WriteValue("dist", _dist, elasticsearchCrudJsonWriter, _distSet);
}
else
{
JsonHelper.WriteValue("pre", _pre, elasticsearchCrudJsonWriter, _preSet);
JsonHelper.WriteValue("post", _post, elasticsearchCrudJsonWriter, _postSet);
}
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例8: SerializeAnalyzerWithAsciifoldingFilter
public void SerializeAnalyzerWithAsciifoldingFilter()
{
const string targetJson =
"\"analysis\":{\"filter\":{\"my_ascii_folding\":{\"type\":\"asciifolding\",\"preserve_original\":true}},\"analyzer\":{\"default\":{\"type\":\"custom\",\"tokenizer\":\"standard\",\"filter\":[\"standard\",\"my_ascii_folding\"]}}}";
var analysis = new Analysis
{
Analyzer =
{
Analyzers = new List<AnalyzerBase>
{
new CustomAnalyzer("default")
{
Tokenizer = DefaultTokenizers.Standard,
Filter = new List<string> {"standard", "my_ascii_folding"}
}
}
},
Filters =
{
CustomFilters = new List<AnalysisFilterBase> {new AsciifoldingTokenFilter("my_ascii_folding") {PreserveOriginal = true}}
}
};
var jsonWriter = new ElasticsearchCrudJsonWriter();
analysis.WriteJson(jsonWriter);
var result = jsonWriter.GetJsonString();
Console.WriteLine(result);
Assert.AreEqual(targetJson, result);
}
示例9: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("exists");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
JsonHelper.WriteValue("field", _field, elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例10: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("constant_score");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
if (_querySet)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("query");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_query.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
if (_filterSet)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("filter");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
_filter.WriteJson(elasticsearchCrudJsonWriter);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
JsonHelper.WriteValue("boost", _boost, elasticsearchCrudJsonWriter, _boostSet);
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例11: WriteJson
public void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName(_name);
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
JsonHelper.WriteListValue("types", _indexTypes, elasticsearchCrudJsonWriter, _indexTypesSet);
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("source");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
if (_querySet)
{
_query.WriteJson(elasticsearchCrudJsonWriter);
}
if (_aggsSet)
{
elasticsearchCrudJsonWriter.JsonWriter.WritePropertyName("aggs");
elasticsearchCrudJsonWriter.JsonWriter.WriteStartObject();
foreach (var item in _aggs)
{
item.WriteJson(elasticsearchCrudJsonWriter);
}
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
elasticsearchCrudJsonWriter.JsonWriter.WriteEndObject();
}
示例12: WriteValues
private void WriteValues(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
WriteCommonValues(elasticsearchCrudJsonWriter);
JsonHelper.WriteValue("lowercase", _lowercase, elasticsearchCrudJsonWriter, _lowercaseSet);
JsonHelper.WriteValue("pattern", _pattern, elasticsearchCrudJsonWriter, _patternSet);
JsonHelper.WriteValue("flags", _flags, elasticsearchCrudJsonWriter, _flagsSet);
}
示例13: WriteSpecificJson
private void WriteSpecificJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
if (AnalyzerSet)
{
JsonHelper.WriteListValue("filter", _filter, elasticsearchCrudJsonWriter, _filterSet);
JsonHelper.WriteListValue("char_filter", _charFilter, elasticsearchCrudJsonWriter, _charFilterSet);
}
}
示例14: WriteSpecificJson
private void WriteSpecificJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
if (AnalyzerSet)
{
WriteCommonValues(elasticsearchCrudJsonWriter);
JsonHelper.WriteValue("language", _language.ToString(), elasticsearchCrudJsonWriter, _languageSet);
}
}
示例15: WriteJson
public override void WriteJson(ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter)
{
Similarities.WriteJson(elasticsearchCrudJsonWriter);
Analysis.WriteJson(elasticsearchCrudJsonWriter);
JsonHelper.WriteValue("number_of_shards", _numberOfShards, elasticsearchCrudJsonWriter, _numberOfShardsSet);
base.WriteJson(elasticsearchCrudJsonWriter);
}