public void TestSettings() { Assert.AreEqual(this._settings.Host, ElasticsearchConfiguration.Settings().Host); Assert.AreEqual(this._settings.Port, Test.Default.Port); Assert.AreEqual(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex); Assert.AreEqual(this._settings.MaximumAsyncConnections, Test.Default.MaximumAsyncConnections); }
public void TestSettings() { Assert.AreEqual(this._settings.Host, ElasticsearchConfiguration.Settings().Host); Assert.AreEqual(this._settings.Port, Test.Default.Port); Assert.AreEqual(new Uri(string.Format("http://{0}:{1}", ElasticsearchConfiguration.Settings().Host, Test.Default.Port)), this._settings.Uri); Assert.AreEqual(ElasticsearchConfiguration.DefaultIndex, ElasticsearchConfiguration.DefaultIndex); Assert.AreEqual(this._settings.MaximumAsyncConnections, Test.Default.MaximumAsyncConnections); }
public void TestSettingsWithUri() { var uri = new Uri(string.Format("http://{0}:{1}", ElasticsearchConfiguration.Settings().Host, ElasticsearchConfiguration.Settings().Port)); var settings = new ConnectionSettings(uri); Assert.AreEqual(settings.Host, ElasticsearchConfiguration.Settings().Host); Assert.AreEqual(settings.Port, Test.Default.Port); Assert.AreEqual(uri, this._settings.Uri); }
public static void Setup() { var client = new ElasticClient(ElasticsearchConfiguration.Settings(hostOverride: new Uri("http://localhost:9200"))); //uncomment the next line if you want to see the setup in fiddler too //var client = ElasticsearchConfiguration.Client; var projects = NestTestData.Data; var people = NestTestData.People; var boolTerms = NestTestData.BoolTerms; try { var createIndexResult = client.CreateIndex(ElasticsearchConfiguration.DefaultIndex, c => c .NumberOfReplicas(0) .NumberOfShards(1) .AddMapping <ElasticsearchProject>(m => m .MapFromAttributes() .Properties(p => p .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping <Person>(m => m.MapFromAttributes()) .AddMapping <BoolTerm>(m => m.Properties(pp => pp .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.NotAnalyzed)) .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.NotAnalyzed)) )) ); var createAntotherIndexResult = client.CreateIndex(ElasticsearchConfiguration.DefaultIndex + "_clone", c => c .NumberOfReplicas(0) .NumberOfShards(1) .AddMapping <ElasticsearchProject>(m => m .MapFromAttributes() .Properties(p => p .String(s => s.Name(ep => ep.Content).TermVector(TermVectorOption.WithPositionsOffsetsPayloads)))) .AddMapping <Person>(m => m.MapFromAttributes()) .AddMapping <BoolTerm>(m => m.Properties(pp => pp .String(sm => sm.Name(p => p.Name1).Index(FieldIndexOption.NotAnalyzed)) .String(sm => sm.Name(p => p.Name2).Index(FieldIndexOption.NotAnalyzed)) )) ); var bulkResponse = client.Bulk(b => b .IndexMany(projects) .IndexMany(people) .IndexMany(boolTerms) .Refresh() ); } catch (Exception e) { throw; } }
public void Setup() { var client = new ElasticClient( //ElasticsearchConfiguration.Settings(hostOverride: new Uri("http://localhost:9200")) ElasticsearchConfiguration.Settings() ); try { IntegrationSetup.CreateTestIndex(client, ElasticsearchConfiguration.DefaultIndex); IntegrationSetup.CreateTestIndex(client, ElasticsearchConfiguration.DefaultIndex + "_clone"); IntegrationSetup.IndexDemoData(client); } catch (Exception) { throw; } }