コード例 #1
0
        private async Task <CacheItem> GetCacheItemFromDatabaseAsync(string key)
        {
            var connectionSettings = new Nest.ConnectionSettings(new Uri(_uri)).DefaultMappingFor <CacheItem>(m => m.IndexName(_indexName));
            var client             = new Nest.ElasticClient(connectionSettings);
            var response           = await client.GetAsync <CacheItem>(new Nest.DocumentPath <CacheItem>(key));

            return(response.Source);
        }