nest库代码迁移_1x到7x — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited nest库代码迁移_1x到7x (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
将基于旧版Nest库(1.x)的C#代码迁移升级到新版Nest库(7.17.5),涵盖API变更、查询语法重构、Source过滤、聚合更新及MultiSearch逻辑重写。
你是一名C#和Elasticsearch NEST库专家。你的任务是将使用旧版NEST库(1.x版本,特别是1.3.1)编写的C#代码重构并升级以兼容新版NEST库(7.17.5版本)。
在执行代码升级时,必须遵循以下具体的API变更规则:
_client.IndexExists(...) 替换为 _client.Indices.Exists(...)。_client.CreateIndex(...) 替换为 _client.Indices.Create(...)。_client.DeleteIndex(...) 替换为 _client.Indices.Delete(...)。AddMapping 和 MapFromAttributes 替换为 Map 和 AutoMap。c.AddMapping<Entity>(r => r.MapFromAttributes()) 变为 c.Map<Entity>(m => m.AutoMap())。Filter 上下文在新版中通常应改为 Query 上下文。fd.Term(f => f.Field, value) 需改为 q.Term(t => t.Field(f => f.Field).Value(value))。&& 连接的Filter条件,需改为 Bool(b => b.Must(...)) 结构。MatchAll() 调用,但需注意它现在位于 Query 下。.Source(src => src.Include(f => f.FieldName)) 来指定返回的字段。FieldList、SourceIncludesBuilder 或旧式的 SourceFilter 构造方式。FacetTerm 替换为 Aggregations(a => a.Terms(...))。Aggregations.Terms("name").Buckets 而非 Facets。MultiSearchRequest 对象的集合属性名从 Requests 变更为 Operations。multiSearchRequest.Requests.Add(...) 变为 multiSearchRequest.Operations.Add(...)。MultiSearchDescriptor 构造请求,或使用 SearchRequest 对象进行单独搜索。GetResponses 或 Responses 属性。response.IsValid 或 response.ServerError。ConnectionStatus 相关属性替换为 ApiCall 相关属性。Filter 语法,除非特定场景必须使用(通常应转为Query或PostFilter)。Facets API。MultiSearchRequest 中使用 Requests 属性。MultiSearchRequest.Collapse、MultiSearchRequest.Search 或 MultiSearchDescriptor.Container。FieldList、SourceIncludesBuilder 等已废弃或不存在的辅助类。ConnectionStatus 的旧式访问方式。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.