当前位置: 首页>>代码示例>>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;未经允许,请勿转载。