public void CreateNewIndexAndMappingWithAllDisabled()
        {
            var indexDefinition = new IndexDefinition {
                IndexSettings = { NumberOfShards = 3, NumberOfReplicas = 1 }
            };

            indexDefinition.Mapping.All.Enabled = false;

            var mappingTypeAll = new MappingTypeAllTest
            {
                Id = 1,
                DescIncludeInAllFalse = "non",
                DescIncludeInAllTrue  = "yes",
                DescThreeNoDef        = "three"
            };

            using (
                var context = new ElasticsearchContext(ConnectionString,
                                                       new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                context.IndexCreate <MappingTypeAllTest>(indexDefinition);

                context.AddUpdateDocument(mappingTypeAll, mappingTypeAll.Id);
                context.SaveChanges();

                Thread.Sleep(1500);


                var doc = context.Search <MappingTypeAllTest>(BuildSearchById(1));
                Assert.GreaterOrEqual(doc.PayloadResult.Hits.HitsResult.First().Id.ToString(), "1");
            }
        }
Пример #2
0
        public void CreateNewIndexAndMappingWithAllDisabled()
        {
            var indexDefinition = new IndexDefinition {IndexSettings = {NumberOfShards = 3, NumberOfReplicas = 1}};
            indexDefinition.Mapping.All.Enabled = false;

            var mappingTypeAll = new MappingTypeAllTest
            {
                Id = 1,
                DescIncludeInAllFalse = "non",
                DescIncludeInAllTrue = "yes",
                DescThreeNoDef = "three"
            };

            using (
                var context = new ElasticsearchContext(ConnectionString,
                    new ElasticsearchSerializerConfiguration(_elasticsearchMappingResolver)))
            {
                context.TraceProvider = new ConsoleTraceProvider();
                context.IndexCreate<MappingTypeAllTest>(indexDefinition);

                context.AddUpdateDocument(mappingTypeAll, mappingTypeAll.Id);
                context.SaveChanges();

                Thread.Sleep(1500);

                var doc = context.Search<MappingTypeAllTest>(BuildSearchById(1));
                Assert.GreaterOrEqual(doc.PayloadResult.Hits.HitsResult.First().Id.ToString(), "1");
            }
        }