public void Initialize(NuGetSearchAppConfig config) { _nodeLocation = new Uri(config.ServerUri); _settings = new ConnectionSettings(_nodeLocation) .DefaultMappingFor <NuGetSearchMain>(m => m.IndexName(config.IndexName) .IdProperty("Id")); _resolver = new IndexNameResolver(_settings); _indexName = _resolver.Resolve <NuGetSearchMain>(); _client = new ElasticClient(_settings); }
public HomeController(IOptions <NuGetSearchAppConfig> config, ISearchRepo repo) { _repo = repo; _config = config.Value; _repo.Initialize(_config); }