本文整理汇总了C#中Nest.ElasticClient.Count方法的典型用法代码示例。如果您正苦于以下问题:C# ElasticClient.Count方法的具体用法?C# ElasticClient.Count怎么用?C# ElasticClient.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nest.ElasticClient
的用法示例。
在下文中一共展示了ElasticClient.Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AtualizaBuscaHeader
public static string AtualizaBuscaHeader(string parametro)
{
var node = new Uri(URI_ES);
var settings = new ConnectionSettings(node);
var client = new ElasticClient(settings);
String result = parametro;
var seResult = client.Count<dynamic>(c => c
.Index(INDEX)
.Type(PRODSENSE)
.Query(q => q
.Match(m => m
.OnField("descricao_detalhada_produto")
.Query(parametro.ToLower())
)
)
);
result += "|" + seResult.Count;
seResult = client.Count<dynamic>(c => c
.Index(INDEX)
.Type(DI)
.Query(q => q
.Match(m => m
.OnField("tx_descricaoMercadoria")
.Query(parametro.ToLower())
)
)
);
result += "|" + seResult.Count;
//Consultando CE
seResult = client.Count<dynamic>(c => c
.Index(INDEX)
.Type(CE)
.Query(q => q
.Match(m => m
.OnField("txmercadoria")
.Query(parametro.ToLower())
)
)
);
result += "|" + seResult.Count;
return result;
}
示例2: ConsultaElasticSearchCountDocumentos
public static List<AgregationsPorBucketQtde> ConsultaElasticSearchCountDocumentos(string paramatro, string index)
{
var node = new Uri(URI_ES);
var settings = new ConnectionSettings(node);
var client = new ElasticClient(settings);
var resultDI = client.Count<DIPOCO>(c => c
.Index(index)
.Type(DI)
.Query(q => q
.Match(m => m
.OnField("tx_descricaoMercadoria")
.Query(paramatro.ToLower())
)
)
);
List<AgregationsPorBucketQtde> listResultados = new List<AgregationsPorBucketQtde>();
AgregationsPorBucketQtde resumoBusca = new AgregationsPorBucketQtde();
resumoBusca.name = DI;
resumoBusca.qtde = resultDI.Count;
listResultados.Add(resumoBusca);
//Consultando CE
var resultCE = client.Count<CE_POCO>(c => c
.Index(index)
.Type(CE)
.Query(q => q
.Match(m => m
.OnField("txmercadoria")
.Query(paramatro.ToLower())
)
)
);
resumoBusca = new AgregationsPorBucketQtde();
resumoBusca.name = CE;
resumoBusca.qtde = resultCE.Count;
listResultados.Add(resumoBusca);
return listResultados;
}