简体   繁体   English

弹性嵌套将元添加到聚合

[英]Elastic Nest Adding Meta to Aggregations

I am successfully creating Aggregations with my Elastic NEST query but I would like to pass some additional information in I have seen that I can use Meta for this, but I cannot find any documentation for doing it in NEST. 我已经用我的Elastic NEST查询成功创建了聚合,但是我想传递一些其他信息,因为我已经看到可以使用Meta了,但是我找不到在NEST中进行此操作的任何文档。

HERE is my nest Aggregations code 这里是我的巢式汇总代码

.Aggregations(aa => aa.Terms("groups", sp => sp.Field(p => p.ProductSpecification.Suffix("name"))
                    .Aggregations(aaa => aaa
                        .Terms("attribute", tt => tt.Field(ff => ff.ProductSpecification.Suffix("value"))))

Basically id like to be add say SpecificationId to the meta any hints? 基本上id是要添加说规范ID到meta任何提示吗?

You can add meta per aggregation, and it'll be returned on the aggregation response 您可以为每个聚合添加meta ,它将在聚合响应中返回

var response = client.Search<User>(s => s
    .Size(0)
    .Query(q => +q
        .Term(m => m
            .Field(f => f.Badges.First().Name)
            .Value("c#")
        )
    )
    .Aggregations(a => a
        .SignificantTerms("badges", st => st
            .Field(f => f.Badges.First().Name)
            .Meta(m => m
                .Add("meta_1", "value_1")
                .Add("meta_2", 2)
            )
        )
    )
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM