Пример #1
0
        public void CreateNewIndexAndMappingForNestedChild()
        {
            var mappingTestsParent = new MappingTestsParent
            {
                Calls = 3,
                MappingTestsParentId = 2,
                MappingTestsItem     = new MappingTestsChild
                {
                    Description         = "Hello nested",
                    MappingTestsChildId = 5
                }
            };

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

                Assert.NotNull(doc);
            }
        }
Пример #2
0
        private static MappingTestsParent SetupIndexMappingTests(string index, out IElasticsearchMappingResolver elasticsearchMappingResolver)
        {
            var mappingTestsParent = new MappingTestsParent
            {
                Calls = 3,
                MappingTestsParentId = 2,
                MappingTestsItem     = new MappingTestsChild
                {
                    Description         = "Hello nested",
                    MappingTestsChildId = 5
                }
            };

            elasticsearchMappingResolver = new ElasticsearchMappingResolver();
            elasticsearchMappingResolver.AddElasticSearchMappingForEntityType(typeof(MappingTestsParent),
                                                                              MappingUtils.GetElasticsearchMapping(index));
            return(mappingTestsParent);
        }
Пример #3
0
        public void CreateNewIndexAndMappingForNestedChild()
        {
            var mappingTestsParent = new MappingTestsParent
            {
                Calls = 3,
                MappingTestsParentId = 2,
                MappingTestsItem = new MappingTestsChild
                {
                    Description = "Hello nested",
                    MappingTestsChildId = 5
                }
            };

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

                Assert.IsNotNull(doc);
            }
        }
Пример #4
0
        private static MappingTestsParent SetupIndexMappingTests(string index, out IElasticsearchMappingResolver elasticsearchMappingResolver)
        {
            var mappingTestsParent = new MappingTestsParent
            {
                Calls = 3,
                MappingTestsParentId = 2,
                MappingTestsItem = new MappingTestsChild
                {
                    Description = "Hello nested",
                    MappingTestsChildId = 5
                }
            };

            elasticsearchMappingResolver = new ElasticsearchMappingResolver();
            elasticsearchMappingResolver.AddElasticSearchMappingForEntityType(typeof (MappingTestsParent),
                MappingUtils.GetElasticsearchMapping(index));
            return mappingTestsParent;
        }