Ejemplo n.º 1
0
        public void TestSingleIndexMapping()
        {
            var connection = new Connection {
                Name     = "input",
                Provider = "elasticsearch",
                Index    = "colors",
                Server   = "localhost",
                Port     = 9200
            }.WithValidation();

            connection.Url = connection.BuildElasticUrl();

            var pool         = new SingleNodeConnectionPool(new Uri(connection.Url));
            var settings     = new ConnectionConfiguration(pool);
            var client       = new ElasticLowLevelClient(settings);
            var context      = new ConnectionContext(new PipelineContext(new TraceLogger()), connection);
            var schemaReader = new ElasticSchemaReader(context, client);

            Assert.AreEqual(11, schemaReader.GetFields("rows").Count());
        }
        public void TestAllIndexMapping()
        {
            var connection = new Connection {
                Name     = "input",
                Provider = "elasticsearch",
                Index    = "colors",
                Server   = "localhost",
                Port     = 9200
            };

            connection.Url = connection.GetElasticUrl();

            var pool         = new SingleNodeConnectionPool(new Uri(connection.Url));
            var settings     = new ConnectionConfiguration(pool);
            var client       = new ElasticLowLevelClient(settings);
            var context      = new ConnectionContext(new PipelineContext(new DebugLogger()), connection);
            var schemaReader = new ElasticSchemaReader(context, client);


            Assert.AreEqual(1, schemaReader.GetEntities().Count());
        }