本文整理汇总了C#中Nest.ConnectionSettings.DefaultIndex方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionSettings.DefaultIndex方法的具体用法?C# ConnectionSettings.DefaultIndex怎么用?C# ConnectionSettings.DefaultIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nest.ConnectionSettings
的用法示例。
在下文中一共展示了ConnectionSettings.DefaultIndex方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClient
public static IElasticClient GetClient()
{
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node);
settings.DefaultIndex("stackoverflow");
return new ElasticClient(settings);
}
示例2: ElasticSearchDataProvider
public ElasticSearchDataProvider(string connectionString)
{
var settings = new ConnectionSettings(new Uri(connectionString));
settings.DefaultIndex(DEFAULT_INDEX);
_client = new ElasticClient(settings);
Initialize();
}
示例3: DefaultSettings
private static ConnectionSettings DefaultSettings(ConnectionSettings settings) => settings
.DefaultIndex("default-index")
.PrettyJson()
.InferMappingFor<Project>(map => map
.IndexName("project")
.IdProperty(p => p.Name)
)
.InferMappingFor<CommitActivity>(map => map
.IndexName("project")
.TypeName("commits")
)
.InferMappingFor<Developer>(map => map
.IndexName("devs")
.Ignore(p => p.PrivateValue)
.Rename(p => p.OnlineHandle, "nickname")
)
.InferMappingFor<PercolatedQuery>(map => map
.IndexName("queries")
.TypeName(PercolatorType)
)
//.EnableTcpKeepAlive(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(2))
//.PrettyJson()
//TODO make this random
//.EnableHttpCompression()
.OnRequestDataCreated(data=> data.Headers.Add("TestMethod", ExpensiveTestNameForIntegrationTests()));
示例4: SalusElasticSearch
public SalusElasticSearch()
{
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node);
settings.DefaultIndex("my-application");
this.client = new ElasticClient(settings);
}
示例5: SearchService
public SearchService(IConfiguration configuration)
{
var connectionString = new Uri(configuration["Search:Url"]);
var indexName = configuration["Search:IndexName"];
var settings = new ConnectionSettings(connectionString);
settings.DefaultIndex(indexName);
_client = new ElasticClient(settings);
}
示例6: SearchProvider
public SearchProvider()
{
esNode = new Uri("http://localhost:9200");
esSettings = new ConnectionSettings(esNode);
esSettings.DefaultIndex(def_index);
esClient = new ElasticClient(esSettings);
//Shownig Elastic info in Console
//Console.WriteLine(esClient.NodesInfo().ToString());
//Console.ReadKey();
}
示例7: DefaultSettings
private static ConnectionSettings DefaultSettings(ConnectionSettings settings) => settings
.DefaultIndex("default-index")
.PrettyJson()
.InferMappingFor<Project>(map => map
.IndexName("project")
.IdProperty(p => p.Name)
)
.InferMappingFor<CommitActivity>(map => map
.IndexName("project")
.TypeName("commits")
)
.InferMappingFor<Developer>(map => map
.IndexName("devs")
.Ignore(p => p.PrivateValue)
.Rename(p => p.OnlineHandle, "nickname")
)
//We try and fetch the test name during integration tests when running fiddler to send the name
//as the TestMethod header, this allows us to quickly identify which test sent which request
.GlobalHeaders(new NameValueCollection
{
{ "TestMethod", ExpensiveTestNameForIntegrationTests() }
});
示例8: ElasticSearchSetup
// Create index for filling data
// @indexName : whatever
public void ElasticSearchSetup(string indexName)
{
Uri node = new Uri(ElasticServer);
ConnectionSettings settings = new ConnectionSettings(node);
settings.DefaultIndex(indexName);
client = new ElasticClient(settings);
// create the index if it doesn't exist
if (!client.IndexExists(indexName).Exists)
{
client.CreateIndex(indexName);
}
}