コード例 #1
0
ファイル: GroupByTests.cs プロジェクト: hoonzis/fluentnest
        public string AddSimpleTestData()
        {
            var indexName = "index_" + Guid.NewGuid();
            Client.CreateIndex(indexName, x => x.Mappings(
                m => m.Map<Car>(t => t
            .Properties(prop => prop.String(str => str.Name(s => s.EngineType).Index(FieldIndexOption.NotAnalyzed))))));

            for (int i = 0; i < 10; i++)
            {
                var car = new Car
                {
                    Timestamp = new DateTime(2010, i + 1, 1),
                    Name = "Car" + i,
                    Price = 10,
                    Sold = i % 2 == 0,
                    CarType = "Type" + i % 3,
                    Length = i,
                    EngineType = i % 2 == 0 ? EngineType.Diesel : EngineType.Standard,
                    Weight = 5,
                    ConditionalRanking = i % 2 == 0 ? null : (int?)i,
                    Description = "Desc" + i,
                };
                Client.Index(car, ind => ind.Index(indexName));
            }
            Client.Flush(indexName);
            return indexName;
        }
コード例 #2
0
        private string AddSimpleTestData()
        {
            var indexName = "index_" + Guid.NewGuid();
            Client.CreateIndex(indexName, x => x.Mappings(m => m
            .Map<Car>(t => t
                .Properties(prop => prop.String(str => str.Name(s => s.Guid).Index(FieldIndexOption.NotAnalyzed)))
                .Properties(prop => prop.String(str => str.Name(s => s.Email).Index(FieldIndexOption.NotAnalyzed)))
            )));

            for (int i = 0; i < 10; i++)
            {
                var car = new Car
                {
                    BIG_CASE_NAME = "big" + i % 3
                };

                Client.Index(car, ind => ind.Index(indexName));
            }
            Client.Flush(indexName);
            return indexName;
        }
コード例 #3
0
ファイル: Benchmarking.cs プロジェクト: hoonzis/fluentnest
        private string AddSimpleTestData()
        {
            var indexName = "index_" + Guid.NewGuid();

            Client.CreateIndex(indexName, x => x.Mappings(m => m
            .Map<Car>(t => t
                .Properties(prop => prop.String(str => str.Name(s => s.Guid).Index(FieldIndexOption.NotAnalyzed)))
                .Properties(prop => prop.String(str => str.Name(s => s.Email).Index(FieldIndexOption.NotAnalyzed)))
            )));

            var cars = new List<Car>();
            for (int i = 0; i < 10000; i++)
            {
                var car = new Car
                {
                    Timestamp = new DateTime(2010, (i % 12) + 1, 1),
                    Name = "name" + i % 3,
                    Price = 10,
                    Sold = i % 2 == 0,
                    CarType = "Type" + i % 2,
                    Emissions = i + 1,
                    Guid = "test-" + i,
                    Email = "Email@email" + i % 2 + ".com",
                    Age = i + 1,
                    Enabled = i % 2 == 0,
                    Active = i % 2 == 0,
                    EngineType = i % 2 == 0 ? EngineType.Diesel : EngineType.Standard
                };
                cars.Add(car);
            }
            Client.Bulk(x => x.CreateMany(cars).Index(indexName));
            Client.Flush(indexName);
            return indexName;
        }
コード例 #4
0
ファイル: HistogramTests.cs プロジェクト: hoonzis/fluentnest
 private string AddSimpleTestData()
 {
     var indexName = "index_" + Guid.NewGuid();
     Client.CreateIndex(indexName, x => x.Mappings(m => m.Map<Car>(t => t.Properties(prop => prop.String(str => str.Name(s => s.EngineType).Index(FieldIndexOption.NotAnalyzed))))));
     for (int i = 0; i < 10; i++)
     {
         var car = new Car
         {
             Timestamp = new DateTime(2010,i+1,1),
             Name = "Car" + i,
             Price = 10,
             Sold = i % 2 == 0 ? true : false,
             CarType = "Type" + i%3,
             Length = i*2,
             Weight = i
         };
         Client.Index(car, ind => ind.Index(indexName));
     }
     Client.Flush(indexName);
     return indexName;
 }