fix 轨迹删除by查询,code未加关键字

This commit is contained in:
李鹏军 2024-03-05 16:01:52 +08:00
parent 362ea52f2e
commit 0bfc8708be

View File

@ -44,7 +44,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
if (!r.IsValid)
{
LogHelper.Error($"轨迹数据新增失败,原因:{r.DebugInformation}。");
LogHelper.Error($"轨迹新增失败,原因:{r.DebugInformation}。");
}
}
else
@ -57,7 +57,7 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
if (!r.IsValid)
{
LogHelper.Error($"轨迹数据更新失败,原因:{r.DebugInformation}。");
LogHelper.Error($"轨迹更新失败,原因:{r.DebugInformation}。");
}
}
}
@ -108,14 +108,17 @@ internal class TrackDetailsRepository : ElasticSearchContextAbstract<TrackDetail
public async Task DeleteTrackAsync(int orderId, List<string> trackCodes)
{
await Context.UpdateByQueryAsync<TrackDetailsIndex>(x => x
var r = await Context.UpdateByQueryAsync<TrackDetailsIndex>(x => x
.Query(
q =>
q.Term(t => t.OrderId, orderId)
&& q.Terms(t => t.Field(f => f.TrackCode).Terms(trackCodes)))
&& q.Terms(t => t.Field(f => f.TrackCode.Suffix("keyword")).Terms(trackCodes)))
.Script(s => s
.Source("ctx._source.isDeleted = true"))
);
if (!r.IsValid)
throw new Exception($"轨迹数据删除失败,原因:{r.DebugInformation}");
}
public async Task<(List<TrackDetailsIndex> list, long total)> GetListAsync(TrackDetailsQueryInput input)