Beispiel #1
0
        public void CreateNewIndexAndMappingWithSimpleNullListAndNullArrayList()
        {
            var mappingTestsParent = new MappingTestsParentWithSimpleNullAndNullArrayList
            {
                Calls = 3,
                MappingTestsParentId = 2,
                Call2s = "test"
            };

            using (
                var context = new ElasticsearchContext(ConnectionString,
                                                       new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                context.AddUpdateDocument(mappingTestsParent, mappingTestsParent.MappingTestsParentId);
                context.SaveChangesAndInitMappings();

                Thread.Sleep(1500);
                var doc = context.GetDocument <MappingTestsParentWithSimpleNullAndNullArrayList>(mappingTestsParent.MappingTestsParentId);

                Assert.NotNull(doc);

                Thread.Sleep(1500);
                context.IndexClose("mappingtestsparentwithsimplenullandnullarraylists");
                Thread.Sleep(1500);
                context.IndexOpen("mappingtestsparentwithsimplenullandnullarraylists");
                Thread.Sleep(1500);
                var result = context.IndexOptimize("mappingtestsparentwithsimplenullandnullarraylists", new OptimizeParameters {
                    NumberOfShards = 3, Flush = true
                });

                Assert.InRange(result.PayloadResult.Shards.Successful, 2, 1000000);
            }
        }
Beispiel #2
0
        public void CreateNewIndexAndMappingWithSimpleNullListAndNullArrayList()
        {
            var mappingTestsParent = new MappingTestsParentWithSimpleNullAndNullArrayList
            {
                Calls = 3,
                MappingTestsParentId = 2,
                Call2s="test"
            };

            using (
                var context = new ElasticsearchContext(ConnectionString,
                    new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                context.AddUpdateDocument(mappingTestsParent, mappingTestsParent.MappingTestsParentId);
                context.SaveChangesAndInitMappings();

                Thread.Sleep(1500);
                var doc = context.GetDocument<MappingTestsParentWithSimpleNullAndNullArrayList>(mappingTestsParent.MappingTestsParentId);

                Assert.IsNotNull(doc);

                context.IndexClose("mappingtestsparentwithsimplenullandnullarraylists");
                context.IndexOpen("mappingtestsparentwithsimplenullandnullarraylists");
                var result = context.IndexOptimize("mappingtestsparentwithsimplenullandnullarraylists", new OptimizeParameters{NumberOfShards=3, Flush=true});

                Assert.GreaterOrEqual(result.PayloadResult.Shards.Successful, 1);
            }
        }