本文整理匯總了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;
}