/// <summary> /// 根据id更新部分实体字段 /// </summary> /// <typeparam name="TPartialDocument">包含实体T中部分字段的是model</typeparam> /// <param name="id">主键</param> /// <param name="partEntity">部分实体model</param> /// <param name="routing">路由键</param> /// <returns></returns> public async Task <HttpResponseResultModel <bool> > UpdatePartialDocumentAsync <TPartialDocument, TPrimaryKeyType>(TPrimaryKeyType id, InsertUpdateModel <TPartialDocument> insertUpdateModel) where TPartialDocument : class, new() { HttpResponseResultModel <bool> httpResponseResultModel = new HttpResponseResultModel <bool>(); string indexName = insertUpdateModel.IndexName?.ToLower(); if (string.IsNullOrEmpty(indexName)) { indexName = PocoIndexName; } UpdateDescriptor <TEntity, TPartialDocument> updRequest = new UpdateDescriptor <TEntity, TPartialDocument>(indexName, id.ToString()); updRequest.Doc(insertUpdateModel.Entity); updRequest.Index(indexName); if (!string.IsNullOrEmpty(insertUpdateModel.Routing)) { updRequest.Routing(insertUpdateModel.Routing); } var response = await client.UpdateAsync <TEntity, TPartialDocument>(updRequest).ConfigureAwait(false); GetDebugInfo(response); httpResponseResultModel.IsSuccess = (response.Result == Result.Updated); return(httpResponseResultModel); }