當前位置: 首頁>>代碼示例>>C#>>正文


C# ElasticClient.Count方法代碼示例

本文整理匯總了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;
        }
開發者ID:carlosh10,項目名稱:c-tradv,代碼行數:49,代碼來源:ElasticSearchDAO.cs

示例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;
        }
開發者ID:carlosh10,項目名稱:c-tradv,代碼行數:42,代碼來源:ElasticSearchDAO.cs


注:本文中的Nest.ElasticClient.Count方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。