Esempio n. 1
0
        public void CreateNewIndexAndMappingWithSimpleList()
        {
            var mappingTestsParent = new MappingTestsParentWithSimpleList
            {
                Calls = 3,
                MappingTestsParentId = 2,
                Call2s = "test",
                MappingTestsItemIntList = new List <int> {
                    2, 7, 44, 176
                },
                MappingTestsItemShortArray = new short[] { 4, 7, 89, 9 }
            };

            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 <MappingTestsParentWithSimpleList>(mappingTestsParent.MappingTestsParentId);

                Assert.NotNull(doc);
            }
        }
Esempio n. 2
0
        public void CreateNewIndexAndMappingWithSimpleList()
        {
            var mappingTestsParent = new MappingTestsParentWithSimpleList
            {
                Calls = 3,
                MappingTestsParentId = 2,
                Call2s="test",
                MappingTestsItemIntList = new List<int> { 2, 7, 44, 176},
                MappingTestsItemShortArray =  new short[] { 4,7,89,9}
            };

            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<MappingTestsParentWithSimpleList>(mappingTestsParent.MappingTestsParentId);

                Assert.IsNotNull(doc);
            }
        }