public async Task <IResult> UpdateByElasticIdAsync(ElasticSearchInsertUpdateModel model) { var elasticClient = GetElasticClient(model.IndexName); var response = await elasticClient.UpdateAsync <object>(model.ElasticId, u => u.Index(model.IndexName).Doc(model.Item)); return(new Results.Result(success: response.IsValid, message: response.IsValid ? "Success" : response.ServerError.Error.Reason)); }
public async Task <IResult> InsertAsync(ElasticSearchInsertUpdateModel model) { var elasticClient = GetElasticClient(model.IndexName); var response = await elasticClient.IndexAsync(model.Item, i => i.Index(model.IndexName) .Id(model.ElasticId) .Refresh(Elasticsearch.Net.Refresh.True)); return(new Results.Result(success: response.IsValid, message: response.IsValid ? "Success" : response.ServerError.Error.Reason)); }