コード例 #1
0
        public void Setup()
        {
            var doc1 = new MoreLikeThisTestDto
            {
                Id       = 1,
                Info     = "yes this is great",
                MoreInfo = "yes, I am going to test this query"
            };

            var doc2 = new MoreLikeThisTestDto
            {
                Id       = 2,
                Info     = "yes this is great two",
                MoreInfo = "yes, I am going to test this query"
            };

            var doc3 = new MoreLikeThisTestDto
            {
                Id       = 3,
                Info     = "yes this is great three",
                MoreInfo = "no, I am going to test this query"
            };


            using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchMappingResolver()))
            {
                context.IndexCreate <MoreLikeThisTestDto>();
                Thread.Sleep(1200);
                context.AddUpdateDocument(doc1, doc1.Id);
                context.AddUpdateDocument(doc2, doc2.Id);
                context.AddUpdateDocument(doc3, doc3.Id);
                context.SaveChanges();
                Thread.Sleep(1200);
            }
        }
コード例 #2
0
        public void Setup()
        {
            var doc1 = new MoreLikeThisTestDto
            {
                Id = 1,
                Info = "yes this is great",
                MoreInfo = "yes, I am going to test this query"
            };

            var doc2 = new MoreLikeThisTestDto
            {
                Id = 2,
                Info = "yes this is great two",
                MoreInfo = "yes, I am going to test this query"
            };

            var doc3 = new MoreLikeThisTestDto
            {
                Id = 3,
                Info = "yes this is great three",
                MoreInfo = "no, I am going to test this query"
            };

            using (var context = new ElasticsearchContext(ConnectionString, new ElasticsearchMappingResolver()))
            {
                context.IndexCreate<MoreLikeThisTestDto>();
                Thread.Sleep(1200);
                context.AddUpdateDocument(doc1, doc1.Id);
                context.AddUpdateDocument(doc2, doc2.Id);
                context.AddUpdateDocument(doc3, doc3.Id);
                context.SaveChanges();
                Thread.Sleep(1200);
            }
        }