Exemple #1
0
 /// <summary>
 ///     Creates the index mappings list and adds the .notedef glyphs
 /// </summary>
 private void InsertNotdefGlyphs()
 {
     // Ensure first three glyph are included.  These glyphs represent
     // the .notdef characters which is commonly located at glyph index 0,
     // but sometimes indices 1 or 2.
     indexMappings = new IndexMappings();
     indexMappings.Add(0, 1, 2);
 }
Exemple #2
0
        public void Test1()
        {
            var config = new Configuration {
                Index = "Test1"
            };
            var client        = new ElasticClient(new ConnectionSettings(new Uri("http://localhost:9200")));
            var indexMappings = new IndexMappings(config, client);
            var result        = indexMappings.CreateIndex();

            result.IsValid.ShouldBeTrue();

            CleanUpIndex(client, config);
        }
Exemple #3
0
        private static ElasticClient CreateIndex(Configuration config)
        {
            var connection = new ConnectionSettings(new Uri("http://localhost:9200"))
                             .DisableDirectStreaming()
                             .OnRequestCompleted(apiCallDetails =>
            {
                // log out the request and the request body, if one exists for the type of request
                if (apiCallDetails.RequestBodyInBytes != null)
                {
                    Log.Information(
                        $"{apiCallDetails.HttpMethod} {apiCallDetails.Uri} " +
                        $"{Encoding.UTF8.GetString(apiCallDetails.RequestBodyInBytes)}");
                }
                else
                {
                    Log.Information($"{apiCallDetails.HttpMethod} {apiCallDetails.Uri}");
                }

                // log out the response and the response body, if one exists for the type of response
                if (apiCallDetails.ResponseBodyInBytes != null)
                {
                    Log.Information($"Status: {apiCallDetails.HttpStatusCode}" +
                                    $"{Encoding.UTF8.GetString(apiCallDetails.ResponseBodyInBytes)}");
                }
                else
                {
                    Log.Information($"Status: {apiCallDetails.HttpStatusCode}");
                }
            });
            var client        = new ElasticClient(connection);
            var indexMappings = new IndexMappings(config, client);
            var result        = indexMappings.CreateIndex();

            result.IsValid.ShouldBeTrue();
            return(client);
        }