/// <summary> /// 创建索引 /// </summary> /// <param name="index">索引名称。注意:必须小写</param> /// <param name="alias">别名名称。注意:必须小写</param> /// <param name="selector">映射操作</param> /// <param name="cancellationToken">取消令牌</param> public async Task <CreateIndexResponse> CreateIndexAsync(string index, string alias = null, Func <CreateIndexDescriptor, ICreateIndexRequest> selector = null, CancellationToken cancellationToken = default) { var result = await _client.Indices.CreateAsync(_resolver.GetIndexName(index), selector, cancellationToken); if (alias.IsEmpty() == false) { await _client.Indices.PutAliasAsync(_resolver.GetIndexName(index), alias, ct : cancellationToken); } return(result); }
private string GetIndexName <TEntity>(string propertyName) where TEntity : IAeroEntity, new() { return(_indexNameResolver.GetIndexName <TEntity>(propertyName)); }