2016-08-02 62 views
0

在ElasticSearch短語這是我的聚集:聚集通過使用C#巢

return a => 
        a.Terms("Group1", t => t.Field(ff => ff.ItemAttributeDesc1). 
         Aggregations(aa => aa.Terms("Value1", tt => tt.Field(fff => fff.SearchedFilterValue1)))) 
        .Terms("Group2", t => t.Field(ff => ff.ItemAttributeDesc2). 
         Aggregations(aa => aa.Terms("Value2", tt => tt.Field(fff => fff.SearchedFilterValue2)))) 
        .Terms("Group3", t => t.Field(ff => ff.ItemAttributeDesc3). 
         Aggregations(aa => aa.Terms("Value3", tt => tt.Field(fff => fff.SearchedFilterValue3)))) 
        .Terms("Group4", t => t.Field(ff => ff.ItemAttributeDesc4). 
         Aggregations(aa => aa.Terms("Value4", tt => tt.Field(fff => fff.SearchedFilterValue4)))) 
        .Terms("Group5", t => t.Field(ff => ff.ItemAttributeDesc5). 
         Aggregations(aa => aa.Terms("Value5", tt => tt.Field(fff => fff.SearchedFilterValue5)))) 
        .Terms("Group6", t => t.Field(ff => ff.ItemAttributeDesc6). 
         Aggregations(aa => aa.Terms("Value6", tt => tt.Field(fff => fff.SearchedFilterValue6)))) 
        .Terms("Group7", t => t.Field(ff => ff.ItemAttributeDesc7). 
         Aggregations(aa => aa.Terms("Value7", tt => tt.Field(fff => fff.SearchedFilterValue7)))) 
        .Terms("Group8", t => t.Field(ff => ff.ItemAttributeDesc8). 
         Aggregations(aa => aa.Terms("Value8", tt => tt.Field(fff => fff.SearchedFilterValue8)))) 
        .Terms("Brands", t => t.Field(ff => ff.VendorSearch).Size(60).Order(TermsOrder.TermAscending)) 
        .Terms("Category", t => t.Field(ff => ff.MainSearch)) 
        .Range("Price", ra => ra.Field(ff => ff.SalePrice) 
         .Ranges(
         pr => pr.From(50).To(100), 
         pr => pr.From(100).To(250), 
         pr => pr.From(250).To(500), 
         pr => pr.From(500).To(750), 
         pr => pr.From(750).To(1000), 
         pr => pr.From(1000).To(1500), 
         pr => pr.From(1500).To(2000), 
         pr => pr.From(2000).To(2500), 
         pr => pr.From(2500).To(3000), 
         pr => pr.From(3000).To(3500), 
         pr => pr.From(3500))); 

它的工作如預期,除了一兩件事。我必須通過完整的比賽進行彙總。例如,如果我有術語字段「Field」(一個字),它工作正常。但是,如果該術語包含多個單詞(或具有特定符號),則不起作用。不工作,因爲按空格和符號彈性分割短語。我需要100%的比賽。任何人都可以幫我解決這個問題嗎?

回答

1

這是因爲你被聚集在球場上被映射爲一個分析的字符串,作爲字符串類型的默認映射,要解決這個問題,映射你是聚合作爲type: stringindex: not_analyzed

相關領域查看更多有關信息analyzed strings