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


C# ElasticClient.Map方法代碼示例

本文整理匯總了C#中Nest.ElasticClient.Map方法的典型用法代碼示例。如果您正苦於以下問題:C# ElasticClient.Map方法的具體用法?C# ElasticClient.Map怎麽用?C# ElasticClient.Map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nest.ElasticClient的用法示例。


在下文中一共展示了ElasticClient.Map方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Execute

        public IResponse Execute()
        {
            // create client connection
            var node = new Uri(ServerUrl);
            var conn = new ConnectionSettings(node, this.IndexName);
            var client = new ElasticClient(conn);

            // check index name existance
            var existenceResult = client.GetIndex(i => i.Index(IndexName));
            if (existenceResult.ConnectionStatus.Success)
            {
                // delete exist index
                var deleteResult = client.DeleteIndex(i => i.Index(IndexName));
                if (!deleteResult.Acknowledged)
                    return deleteResult;
            }

            // create index
            var createResult = client.CreateIndex(i => i.Index(IndexName));
            if (!createResult.Acknowledged)
                return createResult;

            // set analyzer
            SetAnalyzers(client);

            // put mapping
            var putResult = client.Map<TranslationMemory>(m => m.Index(this.IndexName).MapFromAttributes());
            //var putResult = client.Map<ElasticSearchProject>(m => m.Index(this.IndexName));
            return putResult;
        }
開發者ID:chenchenick,項目名稱:RESTJsonPlayer,代碼行數:30,代碼來源:ElasticDictionaryInitializer.cs

示例2: CreateEmployee

        private bool CreateEmployee(ElasticClient client)
        {
            var response = client.Map<Employee>(u => u
            .Index(ElasticMappingConstants.INDEX_NAME)
            .Type(ElasticMappingConstants.TYPE_EMPLOYEE)
            .AllField(af => af.Enabled())
            .MapFromAttributes()
            );

            return response.Acknowledged;
        }
開發者ID:vigneshc91,項目名稱:Billing,代碼行數:11,代碼來源:ElasticSearchMappings.cs

示例3: CreateProduct

        private bool CreateProduct(ElasticClient client)
        {
            var response = client.Map<Product>(u => u
            .Index(ElasticMappingConstants.INDEX_NAME)
            .Type(ElasticMappingConstants.TYPE_PRODUCT)
            .AllField(af => af.Enabled())
            .MapFromAttributes()
            );

            return response.Acknowledged;
        }
開發者ID:vigneshc91,項目名稱:Billing,代碼行數:11,代碼來源:ElasticSearchMappings.cs

示例4: CreateIndex

 /// <summary>
 /// 創建索引
 /// </summary>
 public void CreateIndex()
 {
     string espath = ConfigurationManager.AppSettings["ESPath"].ToString();
     string indexname = ConfigurationManager.AppSettings["IndexName"].ToString();
     string typename = ConfigurationManager.AppSettings["TypeName"].ToString();
     var node = new Uri(espath);
     var settings = new ConnectionSettings(node);
     var client = new ElasticClient(settings);
     var newbase = new NewsBase();
     client.CreateIndex(indexname);
     client.Map<NewsBase>(m => m.MapFromAttributes());
 }
開發者ID:starckgates,項目名稱:ForSearch,代碼行數:15,代碼來源:Default.aspx.cs

示例5: ElasticsearchClient

        public ElasticsearchClient()
        {
            this.connexion = new Uri("http://10.188.197.209:9200");
            //this.connexion = new Uri("http://localhost:9200");

            //            this.connexion = new Uri("http://192.168.1.14:9200");
            this.connexion = new Uri("http://localhost:9200");
            this.settings = new ConnectionSettings(connexion, defaultIndex: "tp");
            this.client = new ElasticClient(settings);
            client.CreateIndex("tp");
            var mapResult = client.Map<Stockobject>(c => c.MapFromAttributes().IgnoreConflicts().Type("stocks").Indices("tp"));
        }
開發者ID:NicolasGH,項目名稱:Projet_final_NoSql,代碼行數:12,代碼來源:ElasticsearchClient.cs

示例6: EsClient

        /// Constructor
        public EsClient()
        {
            var node = new Uri(ElasticUri);

            _settings = new ConnectionSettings(node);
            _settings.SetDefaultIndex(ConfigurationManager.AppSettings["DefaultIndex"]);
            _settings.MapDefaultTypeNames(m => m.Add(typeof(HadoopMetaDataModels), ConfigurationManager.AppSettings["DefaultIndexType"]));

            Current = new ElasticClient(_settings);
            Current.Map<HadoopMetaDataModels>(m => m
                .MapFromAttributes());
            
        }
開發者ID:tjdurant,項目名稱:DataEntryWebForm,代碼行數:14,代碼來源:ElasticClient.cs

示例7: CreateSalesInfo

        private bool CreateSalesInfo(ElasticClient client)
        {
            var response = client.Map<SalesInfo>(u => u
            .Index(ElasticMappingConstants.INDEX_NAME)
            .Type(ElasticMappingConstants.TYPE_SALES_INFO)
            .AllField(af => af.Enabled())
            .MapFromAttributes()
            );

            return response.Acknowledged;
        }
開發者ID:vigneshc91,項目名稱:Billing,代碼行數:11,代碼來源:ElasticSearchMappings.cs


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