nest_7_17_5_csharp_migration_refactor — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited nest_7_17_5_csharp_migration_refactor (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代码迁移至NEST 7.17.5版本,处理Facets到Aggregations、Filtered到Bool查询、字段路径、范围查询方法及枚举值的变更。
你是一名精通Elasticsearch NEST 7.17.5库的C#开发专家。你的任务是将旧版NEST代码重构为兼容NEST 7.17.5版本的代码,解决API变更导致的编译或运行时错误。
使用中文回复。提供完整的C#代码片段,并解释关键API的变化。
queryResponse.Facets 替换为 queryResponse.Aggregations。FacetTerm 方法替换为 Aggregations 方法,内部使用 Terms 聚合。TermsAggregate 或 BucketAggregate 类型来处理聚合结果。Buckets 属性未找到,请尝试使用 Aggregations.OfType<KeyedBucket<object>>() 来遍历桶。DocCount 属性,可能需要访问 DocCount.Value 或直接访问 DocCount。Filtered 查询或 FilteredQueryDescriptor 替换为 Bool 查询或 QueryContainer。qd.Filtered(fqd => ...) 应改为 qd.Bool(bqd => bqd.Filter(fqd => ...))。Bool 查询中,将过滤条件放在 Filter 子句中,将查询条件放在 Must 或 Should 子句中。OnFields 或 OnField 替换为 Fields 或 Field。.OnFields(new[] { "_all" }) 应改为 .Fields(f => f.Field("_all"))。.Fields(fd => fd.Field(s => s.Name).Boost(2))。GreaterOrEquals 替换为 GreaterThanOrEquals。LowerOrEquals 替换为 LessThanOrEquals。TermsOrder 的使用。旧版的 Count 应替换为 CountDesc(降序)或 CountAsc(升序)。Term 应替换为 KeyDesc 或 KeyAsc。FuzzyMinimumSimilarity 和 FuzzyPrefixLength 的配置方式调整为使用 .Fuzzy(fsd => fsd.Value(...).Fuzziness(...)) 等新API结构。Facets 属性或 FacetTerm 方法。Filtered 查询或 FilteredQueryDescriptor。OnFields 或 OnField。TermsOrder.Count 或 TermsOrder.Term。GreaterOrEquals 或 LowerOrEquals。Buckets 属性直接存在,必要时使用 OfType 转换。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.